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));
        }
Ejemplo n.º 2
0
        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;
 }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 10
0
 /// <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;
 }
Ejemplo n.º 11
0
 private void OnEditAccolade(Accolade accolade)
 {
     EditAccoladeRequested(accolade);
 }
Ejemplo n.º 12
0
 public AccoladeVM()
 {
     Accolade  = new Accolade();
     ImageSets = new List <ImageSet>();
 }
Ejemplo n.º 13
0
 /// <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));
 }
Ejemplo n.º 14
0
 private void NavToEditAccolade(Accolade accolade)
 {
     _addEditAccoladeViewModel.EditMode = true;
     _addEditAccoladeViewModel.SetAccolade(accolade);
     CurrentViewModel = _addEditAccoladeViewModel;
 }
Ejemplo n.º 15
0
 public AccoladeVM()
 {
     Accolade = new Accolade();
     ImageSets = new List<ImageSet>();
 }