public ActionResult Create([Bind(Prefix = "Accolade")] Accolade accolade, [Bind(Include = "ImageSets")] List <Guid> imageSets) { if (ModelState.IsValid) { Accolade newAccolade = new Accolade(); newAccolade.AccoladeId = Guid.NewGuid(); newAccolade.Title = accolade.Title; newAccolade.Description = accolade.Description; newAccolade.IsActive = accolade.IsActive; newAccolade.AccountId = accolade.AccountId; newAccolade.ImageSets.Clear(); if (imageSets != null) { newAccolade.ImageSets = UOW.ImageSets.GetSetByIds(imageSets); } UOW.Accolades.Add(newAccolade); UOW.Commit(); accolade = newAccolade; } AccoladeVM vm = new AccoladeVM { Accolade = accolade, ImageSets = UOW.ImageSets.GetAll() }; return(View("Edit", vm)); }
public async Task <Accolade> AddAccoladeAsync(Accolade accolade) { _context.Accolades.Add(accolade); await _context.SaveChangesAsync(); return(accolade); }
public ActionResult Edit([Bind(Prefix = "Accolade")] Accolade accolade, [Bind(Include = "ImageSets")] List <Guid> imageSets) { Accolade dbAccolade = UOW.Accolades.GetById(accolade.AccoladeId); if (dbAccolade != null) { dbAccolade.Title = accolade.Title; dbAccolade.Description = accolade.Description; dbAccolade.IsActive = accolade.IsActive; dbAccolade.AccountId = accolade.AccountId; dbAccolade.ImageSets.Clear(); if (imageSets != null) { dbAccolade.ImageSets = UOW.ImageSets.GetSetByIds(imageSets); } UOW.Commit(); accolade = dbAccolade; } else { return(HttpNotFound()); } AccoladeVM vm = new AccoladeVM { Accolade = accolade, ImageSets = UOW.ImageSets.GetAll() }; return(View(vm)); }
private void UpdateAccolade(SimpleEditableAccolade source, Accolade target) { target.VideoGameId = source.VideoGameId; target.Name = source.Name; target.Description = source.Description; target.ImageUrl = source.ImageUrl; target.Notes = source.Notes; target.DateEarned = source.DateEarned; target.OnlineOnly = source.OnlineOnly; }
public async Task <Accolade> UpdateAccoladeAsync(Accolade accolade) { if (!_context.Accolades.Local.Any(a => a.Id == accolade.Id)) { _context.Accolades.Attach(accolade); } _context.Entry(accolade).State = EntityState.Modified; await _context.SaveChangesAsync(); return(accolade); }
public void SetAccolade(Accolade accolade) { _editingAccolade = accolade; if (Accolade != null) { Accolade.ErrorsChanged -= RaiseCanExecuteChanged; } Accolade = new SimpleEditableAccolade(); Accolade.ErrorsChanged += RaiseCanExecuteChanged; CopyAccolade(accolade, Accolade); }
public ActionResult DeleteConfirmed(Guid id) { Accolade accolade = UOW.Accolades.GetById(id); if (accolade == null) { return(HttpNotFound()); } UOW.Accolades.Delete(accolade); UOW.Commit(); return(RedirectToAction("Index")); }
public ActionResult Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Accolade accolade = UOW.Accolades.GetById(id); if (accolade == null) { return(HttpNotFound()); } AccoladeVM vm = new AccoladeVM { Accolade = accolade }; return(View(vm)); }
public ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Accolade accolade = UOW.Accolades.GetById(id); if (accolade == null) { return(HttpNotFound()); } AccoladeVM vm = new AccoladeVM { Accolade = accolade, ImageSets = UOW.ImageSets.GetAll() }; return(View(vm)); }
/// <summary> /// Passes the <paramref name="round"/> to the base constructor and stores the <paramref name="accolade"/>. /// </summary> /// <param name="round">The <see cref="Round"/> that has had the <paramref name="accolade"/> added.</param> /// <param name="accolade">The <see cref="Accolade"/> added to the <paramref name="round"/>.</param> public RoundAccoladeEvent(Accolade accolade) { this.accolade = accolade; }
private void OnEditAccolade(Accolade accolade) { EditAccoladeRequested(accolade); }
public AccoladeVM() { Accolade = new Accolade(); ImageSets = new List <ImageSet>(); }
/// <summary> /// Adds an <see cref="Accolade"/>. Mainly used by the internal <see cref="AccoladeGenerator"/>. /// </summary> /// <param name="accolade">The <see cref="Accolade"/> to add.</param> public void AddAccolade(Accolade accolade) { generatedAccolades.Add(accolade); MakeEvent(new RoundAccoladeEvent(accolade)); }
private void NavToEditAccolade(Accolade accolade) { _addEditAccoladeViewModel.EditMode = true; _addEditAccoladeViewModel.SetAccolade(accolade); CurrentViewModel = _addEditAccoladeViewModel; }
public AccoladeVM() { Accolade = new Accolade(); ImageSets = new List<ImageSet>(); }