public Festival UpdateFestival(Festival updateData) { throw new NotImplementedException(); }
public ActionResult Create([Bind(Include = "FestivalId,Year,BeginningDate,EndDate")] FestivalDTO updateData) { if (ModelState.IsValid) { var updateDataFull = new Festival() { //FestivalId = updateData.FestivalId, Year = updateData.Year, BeginningDate = updateData.BeginningDate, EndDate = updateData.EndDate, EditedBy = 1,//GetUserId(), EditDate = DateTime.Now }; using (var context = new AF_Context()) { context.Festivals.Add(updateDataFull); context.SaveChanges(); return RedirectToAction("Index"); } } //ViewBag.EditedBy = new SelectList(db.Users, "UserId", "Login", play.EditedBy); //ViewBag.FestivalId = new SelectList(db.Festivals, "FestivalId", "FestivalId", play.FestivalId); return View(updateData); }
public Festival AddFestival(Festival newFestival) { throw new NotImplementedException(); }
public SingleItemResponse<FestivalDTO> UpdateFestival(FestivalDTO updateData) { var updateDataFull = new Festival() { FestivalId = updateData.FestivalId, Year = updateData.Year, BeginningDate = updateData.BeginningDate, EndDate = updateData.EndDate, EditedBy = GetUserId(), EditDate = DateTime.Now }; using (var context = new AF_Context()) { try { Festival fes = context.Festivals.First(f => f.FestivalId == updateData.FestivalId); context.Entry(fes).CurrentValues.SetValues(updateDataFull); context.SaveChanges(); int id = updateData.FestivalId; return GetFestival(id); } catch (Exception ex) { throw; } } }
public SingleItemResponse<FestivalDTO> AddFestival(FestivalDTO newFestival) { var newFestivalFull = new Festival() { Year = newFestival.Year, BeginningDate = newFestival.BeginningDate, EndDate = newFestival.EndDate, EditedBy = GetUserId(), EditDate = DateTime.Now }; using (var context = new AF_Context()) { try { context.Festivals.Add(newFestivalFull); context.SaveChanges(); int id = newFestivalFull.FestivalId; return GetFestival(id); } catch (Exception ex) { throw; } } }
public async Task UpdateFestival(Festival updateData) { using (var context = new AF_Context()) { try { Festival fes = context.Festivals.First(f => f.FestivalId == updateData.FestivalId); context.Entry(fes).CurrentValues.SetValues(updateData); await context.SaveChangesAsync(); } catch (Exception ex) { throw ex; } } }
public async Task AddFestival(Festival newFestival) { using (var context = new AF_Context()) { try { context.Festivals.Add(newFestival); int recordsAffected = await context.SaveChangesAsync(); } catch (Exception ex) { throw ex; } } }
public async Task AddFestival(Festival newFestival) { throw new NotImplementedException(); }