public IActionResult Post([FromBody] TaskAPI item) { if (item == null) { return(BadRequest()); } Task task = TaskAPI.To(item); try { task = new TaskBF(DB).Create(task); return(CreatedAtRoute( "TaskRoute", new { controller = "Task", id = task.ID }, TaskAPI.From(task))); } catch (Exception ex) { return(BadRequest(ex)); } }
public IActionResult Put(long id, [FromBody] TaskAPI item) { if (item == null) { return(BadRequest()); } try { Task updateItem = new TaskBF(DB).Update(TaskAPI.To(item)); return(new ObjectResult(TaskAPI.From(updateItem))); } catch (Exception ex) { return(BadRequest(ex)); } }