Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "yonatanyas"

i cant save any data in the db (i can get the data but can't save it back).

tried to debug it but didn't got any exception/errors

service code:

public class CampaignAppService : ICampaignAppService
    {
        //private readonly IRepository<PreSendCampaign, long> _preSendCampaignRepository;
        private readonly ICampiagnRepository _preSendCampaignRepository;

        public CampaignAppService(ICampiagnRepository preSendCampaignRepository)
        {
            _preSendCampaignRepository = preSendCampaignRepository;
        }


        public PreSendCampaign GetPreSendCampaign(int WorkId)
        {
            PreSendCampaign current = null;

            List<PreSendCampaign> listResults = _preSendCampaignRepository. GetAll().Where(i => i.WorkID.Equals(WorkId)).ToList();

            if (listResults != null && listResults.Count > 0)
            {
                current = listResults[0];
            }

            return current;
        }

        public long SetPreSendCampaign(PreSendCampaign newSendCampaign)
        {
            long newId = 0;

            try
            {
                var Created = _preSendCampaignRepository.InsertOrUpdate(newSendCampaign);
                newId = Created.PreSendCampaignID;
            }
            catch(Exception e)
            {

            }

            return newId;
        }

    }

entity example :

[Table(name: "vts_tbPreSendCampaign_Orc")]
    public class PreSendCampaign : Entity<long>
    {
        [Key]
        public long PreSendCampaignID { get; set; }

        public int WorkID { get; set; }

        [Required]
        public string CampaignBody { get; set; }

        [Required]
        [StringLength(50)]
        public string CampaignSender { get; set; }

        [Required]
        [StringLength(50)]
        public string CampaignTitle { get; set; }

        public bool? IsPublishCampaign { get; set; }
    }

context example:

public IDbSet<PopulationSort> vts_tbPopulationSort { get; set; }
Showing 1 to 1 of 1 entries