public async Task <RedirectToRouteResult> UpdatingCliente(UpdateClienteDto Cliente) { if (!await RepositoryCliente.GetInstance(_context, _mapper).UpdateClienteDto(Cliente)) { return(RedirectToAction("UpdateCliente", new { @Cliente = Cliente, @error = true })); } return(RedirectToAction("GetListCliente")); }
public async Task <RedirectToRouteResult> AddingCliente(CreateClienteDto Cliente) { if (!ModelState.IsValid) { return(RedirectToAction("AddCliente", new { @Cliente = Cliente })); } if (await RepositoryCliente.GetInstance(_context, _mapper).CreateClienteDto(Cliente)) { return(RedirectToAction("GetListCliente")); } else { return(RedirectToAction("AddCliente", new { @Cliente = Cliente, @error = true })); } }
public async Task <ActionResult> UpdateCliente(string cedula, UpdateClienteDto Cliente, bool error = false) { if (cedula == null) { if (Cliente == null) { return(RedirectToAction("GetListCliente", new { @error = true })); } else { ViewBag.error = error; return(View(Cliente)); } } else { UpdateClienteDto ClienteDto = await RepositoryCliente.GetInstance(_context, _mapper).GetClientePerId(cedula); return(View(ClienteDto)); } }
public async Task <ViewResult> GetListClientes(bool error = false) => View(await RepositoryCliente.GetInstance(_context, _mapper).ShowListClienteDto());