public ActionResult UpdateEmailContent(EmailContentVM model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var ToBeUpdated = new ToUserEmailContents()
                    {
                        EmailType = model.EmailType,
                        Subject   = model.Subject,
                        Body      = model.Body
                    };
                    _unitOfWork.Email.UpdateEmailContent(ToBeUpdated);
                    _unitOfWork.Complete();



                    ViewBag.Message = "Updated Successfully";
                    return(PartialView("UserInfoPopUp"));
                }
            }
            catch (Exception e)
            {
                ViewBag.Message = "Error while saving changes " + e.Message;
                return(PartialView("UserInfoPopUp"));
            }
            ViewBag.Message = "Something is not right";
            return(PartialView("UserInfoPopUp"));
        }
Exemplo n.º 2
0
        public ToUserEmailContents UpdateEmailContent(ToUserEmailContents model)
        {
            var ToBeUpdated = _context.ToUserEmailContents.Where(x => x.EmailType.Equals(model.EmailType)).FirstOrDefault();

            ToBeUpdated.Subject = model.Subject;
            ToBeUpdated.Body    = model.Body;
            return(ToBeUpdated);
        }
        public void AddEmailContent(EmailContentVM settings)
        {
            var model = new ToUserEmailContents
            {
                EmailType = settings.EmailType,
                Body      = settings.Body,
                Subject   = settings.Subject
            };

            _context.ToUserEmailContents.Add(model);
        }