public async Task <IActionResult> Update([FromBody] Medicine medicine) { if (medicine.IsValid(out IEnumerable <string> errors)) { var result = await _medicineService.Update(medicine); return(Ok(result)); } else { return(BadRequest(errors)); } }
public async Task <IActionResult> Create([FromBody] Medicine medicine) { if (medicine.IsValid(out IEnumerable <string> errors)) { var result = await _medicineService.Create(medicine); return(CreatedAtAction( nameof(Create), new { id = result.Id }, result)); } else { return(BadRequest(errors)); } }