Example #1
0
        public async Task <IActionResult> UpdateSubjectContentDetail(SubjectContentDetailDtoForEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            _response = await _repo.UpdateSubjectContentDetail(model);

            return(Ok(_response));
        }
Example #2
0
        public async Task <ServiceResponse <object> > UpdateSubjectContentDetail(SubjectContentDetailDtoForEdit model)
        {
            var toUpdate = _context.SubjectContentDetails.Where(m => m.Id == model.Id).FirstOrDefault();

            toUpdate.Heading = model.Heading;
            toUpdate.Order   = model.Order;
            //toUpdate.SubjectContentId = model.SubjectContentId;
            toUpdate.Duration = model.Duration;

            _context.SubjectContentDetails.Update(toUpdate);
            await _context.SaveChangesAsync();

            _serviceResponse.Success = true;
            _serviceResponse.Message = CustomMessage.Updated;
            return(_serviceResponse);
        }