public ActionResult UpdateHelpMessage(Contact_VM contact_VM)
        {
            var UserId = Session["AdminId"];

            if (contact_VM != null)
            {
                contactRepository = new ContactRepository();
                contactRepository.UpdateHelpMessage(contact_VM);
                return(RedirectToAction("HelpMessage", "Admin"));
            }
            return(RedirectToAction("Index", "Admin"));
        }
示例#2
0
 public int Add(Contact_VM contact_VM)
 {
     try
     {
         var contactObj = Mapper.Map <Contact>(contact_VM);
         contactObj.CreatedDate = DateTime.Now;
         _DBContext.Contacts.Add(contactObj);
         return(_DBContext.SaveChanges());
     }
     catch (Exception ex)
     {
         return(-1);
     }
 }
示例#3
0
        public int UpdateHelpMessage(Contact_VM contact_VM)
        {
            var     oldHelpMessage = _DBContext.Contacts.Find(contact_VM.Id);
            Contact contact        = new Contact();

            if (oldHelpMessage != null)
            {
                contact             = Mapper.Map <Contact>(contact_VM);
                contact.IsRead      = true;
                contact.CreatedDate = oldHelpMessage.CreatedDate;
                contact.UpdatedDate = DateTime.Now;
                _DBContext.Contacts.AddOrUpdate(contact);
                return(_DBContext.SaveChanges());
            }
            return(0);
        }