Пример #1
0
        public async Task <IHttpActionResult> Update(PayUpdateDto model)
        {
            bool result = await _payService.Update(model);

            if (!result)
            {
                return(BadRequest());
            }

            return(Ok());
        }
Пример #2
0
        public async Task <bool> Update(PayUpdateDto model)
        {
            try
            {
                var query = _context.Pay.FirstOrDefault(x => x.Id == model.Id);
                query.Total    = model.Total;
                query.CourseId = model.CourseId;
                query.UserId   = model.UserId;

                await _context.SaveChangesAsync();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }