public void Update(Adress adress) { var a = db.Adress.Find(adress.AdressId); a.City = adress.City; a.Street = adress.Street; a.Flat = adress.Flat; a.PhoneNumber = adress.PhoneNumber; a.House = a.House; //db.Entry(adress).State = EntityState.Modified; this.Save(); }
public bool Update(Adress adress) { try { adressDb.Update(adress); return true; } catch (Exception) { return false; } }
public bool Insert(Adress adress) { try { adressDb.Insert(adress); return true; } catch (Exception) { return false; } }
public void Insert(Adress adress) { db.Adress.Add(adress); this.Save(); }
public ActionResult EditAdress(Adress adress) { adress.UserId = db.AdressDb.GetById(adress.AdressId).UserId; db.AdressDb.Update(adress); return RedirectToAction("EditProfile"); }
public ActionResult AddAdress(Adress adress) { adress.UserId = db.UserDb.GetAll().First(x => x.Email == User.Identity.Name).UserId; db.AdressDb.Insert(adress); return RedirectToAction("EditProfile", new {message = "Адрес записан"}); }