public static List <LimitationEmailViewModel> ConvertToLimitationEmailViewModelList(this IEnumerable <LimitationEmail> LimitationEmails)
        {
            List <LimitationEmailViewModel> viewModels = new List <LimitationEmailViewModel>();

            foreach (LimitationEmail LimitationEmail in LimitationEmails)
            {
                viewModels.Add(LimitationEmail.ConvertToLimitationEmailViewModel());
            }
            return(viewModels);
        }
Example #2
0
        public LimitationEmailResponse Create(LimitationEmailViewModel re)
        {
            LimitationEmailResponse response = new LimitationEmailResponse();

            try
            {
                LimitationEmail addedLimitationEmail = unitOfWork.GetLimitationEmailRepository().Create(re.ConvertToLimitationEmail());
                unitOfWork.Save();
                response.LimitationEmail = addedLimitationEmail.ConvertToLimitationEmailViewModel();
                response.Success         = true;
            }
            catch (Exception ex)
            {
                response.LimitationEmail = new LimitationEmailViewModel();
                response.Success         = false;
                response.Message         = ex.Message;
            }

            return(response);
        }
Example #3
0
        public LimitationEmailResponse Delete(Guid identifier)
        {
            LimitationEmailResponse response = new LimitationEmailResponse();

            try
            {
                LimitationEmail deletedLimitationEmail = unitOfWork.GetLimitationEmailRepository().Delete(identifier);

                unitOfWork.Save();

                response.LimitationEmail = deletedLimitationEmail?.ConvertToLimitationEmailViewModel();
                response.Success         = true;
            }
            catch (Exception ex)
            {
                response.LimitationEmail = new LimitationEmailViewModel();
                response.Success         = false;
                response.Message         = ex.Message;
            }

            return(response);
        }