public ActionResult Add(AccountDTO dto) { Helper.AddAccount(dto); return RedirectToAction("Details", new RouteValueDictionary( new { controller = "Home", action = "Details", Id = dto.CustomerId })); }
public static void AddAccount(AccountDTO dto) { using (var db = new WebDBEntities()) { var account = new Account { AccountCode = dto.AccountCode, CustomerId = dto.CustomerId }; db.Accounts.Add(account); db.SaveChanges(); } }