internal async static Task EditMakeAsync(Models.Make make) { using (ApplicationDbContext context = new ApplicationDbContext()) { context.Entry(make).State = System.Data.Entity.EntityState.Modified; await context.SaveChangesAsync(); } }
internal static async Task CreateMakeAsync(Models.Make make) { using (ApplicationDbContext context = new ApplicationDbContext()) { context.Make.Add(make); await context.SaveChangesAsync(); } }
public async Task <ActionResult> Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Models.Make make = await _make.GetMake((Guid)id); if (make == null) { return(HttpNotFound()); } return(View(make)); }
public async Task <ActionResult> Edit(Models.Make make) { if (ModelState.IsValid) { try { await _make.EditMake(make); return(RedirectToAction("Index")); } catch (Exception) { throw; } } return(View(make)); }
public async Task <ActionResult> Create(Models.Make make) { if (ModelState.IsValid) { try { make.Id = Guid.NewGuid(); await _make.CreateMake(make); return(RedirectToAction("Index")); } catch (Exception) { throw; } } return(View(make)); }
public async Task EditMake(Models.Make make) { await DomainLogic.Make.Make.EditMakeAsync(make); }
public async Task CreateMake(Models.Make make) { await DomainLogic.Make.Make.CreateMakeAsync(make); }