public async Task <IActionResult> Edit(Guid id, [FromForm] Appointment item) { if (ModelState.IsValid) { item.Id = id; item.UserId = Guid.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value); var successful = await appointmentsAPI.UpdateAsync(item); if (!successful) { return(BadRequest("Could not update the item.")); } return(RedirectToAction("Index")); } else { return(View("Edit", model: item)); } }
public async Task <bool> UpdateAsync(Appointment appointment) => await client.UpdateAsync(appointment);