예제 #1
0
        public IActionResult PutChecklist(int id, [FromBody] Checklist entity)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != entity.Id)
            {
                return(BadRequest());
            }

            Checklist checklist;

            try
            {
                checklist = _service.Update(id, entity);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_service.ChecklistExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw new AppException("Update failed");
                }
            }
            return(Ok(checklist));
        }
예제 #2
0
        public async Task <IActionResult> UpdateChecklist([FromBody] CheckListDto checkListDto)
        {
            try
            {
                var result = await _checklistService.Update(checkListDto);

                return(Ok(result));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
 public async Task <Models.Checklist> Update([FromBody] Models.Checklist checklistToUpdate, string id, string Token)
 {
     return(await _checklistService.Update(id, checklistToUpdate, Token));
 }