public static void CreateNewAppartment(AppartmentCreateModel model) { using (AppartmentContext db = new AppartmentContext()) { var address = model.Street + " " + model.HomeNumber + (!string.IsNullOrEmpty(model.Building) ? "/" + model.Building : "") + " " + model.Room; db.Appartments.Add(new Entities.Appartment() { Address = address }); db.SaveChanges(); } return; }
public ActionResult CreateNewAppartment(AppartmentCreateModel model) { FunctionWithDB.CreateNewAppartment(model); return(RedirectToAction("Index")); }