public async Task <IActionResult> Index() { try { var model = await _repairStatusService.GetAllAsync(); return(View(model)); } catch (Exception ex) { return(View("Error", ex)); } }
public async Task <IActionResult> GetAll() { try { var model = await _repairStatusService.GetAllAsync(); return(Ok(model)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
private async Task GetSelected() { ViewBag.RepairStatuses = new SelectList(await _repairStatusService.GetAllAsync(), "Id", "Name"); var owners = await _ownerService.GetAllAsync(); ViewBag.Owners = new SelectList(owners.Select(o => new { o.Id, Name = $"{ o.FirstName } { o.LastName.First() }. { o.Patronymic.First() }" }), "Id", "Name"); var masters = await _masterService.GetAllAsync(); ViewBag.Masters = new SelectList(masters.Select(m => new { m.Id, Name = $"{ m.FirstName } { m.LastName.First() }. { m.Patronymic.First() }" }), "Id", "Name"); }