public IHttpActionResult Post([FromBody] CourseModifyViewModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var execution = Service.Create(model); if (execution.Succeded) { return(Ok(execution.Message)); } return(BadRequest(execution.Message)); }
public IHttpActionResult Put(int id, [FromBody] CourseModifyViewModel model) { model.Id = id; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var execution = Service.Update(model); if (execution.Succeded) { return(Ok(execution.Message)); } return(BadRequest(execution.Message)); }