public ActionResult PutClaimedVoucher(int id, ClaimedVoucherUpdateRequest entity)
        {
            if (id != entity.Id)
            {
                return(BadRequest());
            }
            bool success = _claimedSer.Update(entity);

            if (success)
            {
                return(Ok(entity));
            }
            return(Problem("Update failed!"));
        }
Example #2
0
        public bool Update(ClaimedVoucherUpdateRequest entity)
        {
            int            available = entity.Available;
            ClaimedVoucher existed   = _claimedRepo.GetById(entity.Id);

            if (existed == null)
            {
                return(false);
            }
            if (available == existed.Available)
            {
                return(false);
            }
            existed.Available    = available;
            existed.LastUsedDate = DateTime.Now;

            return(_claimedRepo.Update(existed));
        }