public PlayCastDTO(Play play) { PlayId = play.PlayId; Title = play.Title; Author = play.Author; FestivalId = play.FestivalId; Day = play.Day; Order = play.Order; PlayedBy = play.PlayedBy; Motto = play.Motto; }
public Play(Play play) { PlayId = play.PlayId; Title = play.Title; Author = play.Author; FestivalId = play.FestivalId; Day = play.Day; Order = play.Order; Motto = play.Motto; PlayedBy = play.PlayedBy; EditedBy = play.EditedBy; EditDate = play.EditDate; }
public Play UpdatePlay(Play updateData) { throw new NotImplementedException(); }
public Play AddPlay(Play newPlay) { throw new NotImplementedException(); }
public PlayEditViewModel(Play editedPlay, List<int> fesitvalsList) { FestivalsList = fesitvalsList; originalPlay = editedPlay; EditedPlay = new Play(editedPlay); }
public PlayEditViewModel(List<int> fesitvalsList) { FestivalsList = fesitvalsList; EditedPlay = new Play(); }
public PlayEditWindow(Play editedPlay, List<int> fesitvalsList) { PEViewModel = new PlayEditViewModel(editedPlay, fesitvalsList); InitializeComponent(); }
public SingleItemResponse<PlayDataDTO> UpdatePlay(PlayDataDTO updateData) { var updateDataFull = new Play() { PlayId = updateData.PlayId, Title = updateData.Title, Author = updateData.Author, FestivalId = updateData.FestivalId, Day = updateData.Day, Order = updateData.Order, PlayedBy = updateData.PlayedBy, Motto = updateData.Motto, EditedBy = GetUserId(), EditDate = DateTime.Now }; using (var context = new AF_Context()) { try { Play pla = context.Plays.First(p => p.PlayId == updateData.PlayId); context.Entry(pla).CurrentValues.SetValues(updateDataFull); context.SaveChanges(); int id = updateData.PlayId; return GetPlay(id); } catch (Exception ex) { throw; } } }
public SingleItemResponse<PlayDataDTO> AddPlay(PlayDataDTO newPlay) { var newPlayFull = new Play() { Title = newPlay.Title, Author = newPlay.Author, FestivalId = newPlay.FestivalId, Day = newPlay.Day, Order = newPlay.Order, PlayedBy = newPlay.PlayedBy, Motto = newPlay.Motto, EditedBy = GetUserId(), EditDate = DateTime.Now }; using (var context = new AF_Context()) { try { context.Plays.Add(newPlayFull); context.SaveChanges(); int id = newPlayFull.PlayId; return GetPlay(id); } catch (Exception ex) { throw; } } }
public async Task UpdatePlay(Play updateData) { using (var context = new AF_Context()) { try { Play pla = context.Plays.First(p => p.PlayId == updateData.PlayId); context.Entry(pla).CurrentValues.SetValues(updateData); await context.SaveChangesAsync(); } catch (Exception ex) { throw ex; } } }
//public async Task<List<Person>> SearchPeople(PeopleSearchingCriteria criteria) //{ //using (var context = new AF_Context()) //{ // List<Person> q =await context.Awards.Join(context.RelationsPersonAward,a => a,ap => ap.AwardId, (ap, a) => new {ap.AwardId = a.AAwardId}); //from p in context.People //from a in context.Awards //join pa in context.RelationsPersonAward // on new { a.AwardId, p.PersonId} equals new { pa.AwardId, pa.PersonId } // into details //join c in context.Categories // on new {a.CategoryId} equals new {c.CategoryId} // into table //from tab in table //where //select new { ord.OrderID, prod.ProductID, det.UnitPrice };) //} #endregion #region Play public async Task AddPlay(Play newPlay) { using (var context = new AF_Context()) { try { context.Plays.Add(newPlay); int recordsAffected = await context.SaveChangesAsync(); } catch (Exception ex) { throw ex; } } }
public ActionResult Edit([Bind(Include = "PlayId,Title,Author,FestivalId,Day,Order,PlayedBy,Motto")] PlayDataDTO updateData) { if (ModelState.IsValid) { var updateDataFull = new Play() { PlayId = updateData.PlayId, Title = updateData.Title, Author = updateData.Author, FestivalId = updateData.FestivalId, Day = updateData.Day, Order = updateData.Order, PlayedBy = updateData.PlayedBy, Motto = updateData.Motto, EditedBy = 1, //EditedBy = GetUserId(), //??????? EditDate = DateTime.Now }; using (var context = new AF_Context()) { Play pla = context.Plays.Find(updateData.PlayId);// First(p => p.PlayId == updateData.PlayId); string return_s = "Details/" + pla.FestivalId; context.Entry(pla).CurrentValues.SetValues(updateDataFull); //check for substituding only edited //context.Entry(updateDataFull).State = EntityState.Modified; context.SaveChanges(); //int id = updateData.PlayId; //return Redirect(Request.UrlReferrer.ToString()); //RedirectToAction("Index") //return RedirectToAction(return_s); return RedirectToAction(return_s, "Festival"); } } //ViewBag.EditedBy = new SelectList(db.Users, "UserId", "Login", festival.EditedBy); return View(updateData); }
public ActionResult Create([Bind(Include = "PlayId,Title,Author,FestivalId,Day,Order,PlayedBy,Motto")] PlayDataDTO updateData) { if (ModelState.IsValid) { var updateDataFull = new Play() { //PlayId = updateData.PlayId, Title = updateData.Title, Author = updateData.Author, FestivalId = updateData.FestivalId, Day = updateData.Day, Order = updateData.Order, PlayedBy = updateData.PlayedBy, Motto = updateData.Motto, EditedBy = 1, //EditedBy = GetUserId(), //??????? EditDate = DateTime.Now }; using (var context = new AF_Context()) { context.Plays.Add(updateDataFull); string return_s = "Details/" + updateDataFull.FestivalId; context.SaveChanges(); return RedirectToAction(return_s, "Festival"); //TODO: Correct for many and for old id } } //ViewBag.EditedBy = new SelectList(db.Users, "UserId", "Login", updateData.EditedBy); return View(updateData); }
public async Task UpdatePlay(Play updateData) { updateData.EditDate = DateTime.Now; await DataAccess.UpdatePlay(updateData); }
public async Task AddPlay(Play newPlay) { newPlay.EditDate = DateTime.Now; await DataAccess.AddPlay(newPlay); }