Esempio n. 1
0
        public ActionResult Contact()
        {
            Models.UserContext            db          = new Models.UserContext();
            ViewModels.DataForContactView contactView = new ViewModels.DataForContactView()
            {
                Address = db.DataForContacts.FirstOrDefault(x => x.Id == 1).Address, PhoneNumber = db.DataForContacts.FirstOrDefault(x => x.Id == 1).PhoneNumber, WorkDaysWeek = db.DataForContacts.FirstOrDefault(x => x.Id == 1).WorkDaysWeek, StartWorkTime = db.DataForContacts.FirstOrDefault(x => x.Id == 1).StartWorkTime, EndWorkTime = db.DataForContacts.FirstOrDefault(x => x.Id == 1).EndWorkTime
            };

            return(View(contactView));
        }
Esempio n. 2
0
        public ActionResult RedactContact(ViewModels.DataForContactView contact)
        {
            UserContext db           = new UserContext();
            int         idForContact = 1;

            db.DataForContacts.FirstOrDefault(x => x.Id == idForContact).Address       = contact.Address;
            db.DataForContacts.FirstOrDefault(x => x.Id == idForContact).PhoneNumber   = contact.PhoneNumber;
            db.DataForContacts.FirstOrDefault(x => x.Id == idForContact).WorkDaysWeek  = contact.WorkDaysWeek;
            db.DataForContacts.FirstOrDefault(x => x.Id == idForContact).StartWorkTime = contact.StartWorkTime;
            db.DataForContacts.FirstOrDefault(x => x.Id == idForContact).EndWorkTime   = contact.EndWorkTime;
            db.SaveChanges();
            return(RedirectToAction("Index", "Admin"));
        }