public IActionResult Save([FromBody] Type type) { if (type is null) { return(BadRequest("Type is null.")); } if (!ModelState.IsValid) { return(BadRequest()); } if (type.TypeId == 0) { _repository.Create(type); return(new JsonResult(new { create = true, type })); } else { _repository.Update(type); return(new JsonResult(new { update = true, type })); } }
public IActionResult Delete([FromBody] Type type) { _repository.Delete(type); return(new JsonResult(new { delete = true })); }