Esempio n. 1
0
        public bool EditPartyItem(PartyItemEdit partyItemToEdit)
        {
            var entity = _db.PartyItems.Single(p => p.PartyItemId == partyItemToEdit.Id);

            entity.Name  = partyItemToEdit.Name;
            entity.Price = partyItemToEdit.Price;

            return(_db.SaveChanges() == 1);
        }
Esempio n. 2
0
 public ActionResult Edit(PartyItemEdit partyItem)
 {
     if (ModelState.IsValid)
     {
         _userId           = Guid.Parse(User.Identity.GetUserId());
         _partyItemService = new PartyItemService(_userId);
         _partyItemService.EditPartyItem(partyItem);
         return(RedirectToAction("Index"));
     }
     return(View(partyItem));
 }
Esempio n. 3
0
        public IHttpActionResult Put(PartyItemEdit partyItemToEdit)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = CreatePartyItemService();

            if (!service.EditPartyItem(partyItemToEdit))
            {
                return(InternalServerError());
            }

            return(Ok());
        }