public async Task <IActionResult> Index()
        {
            try
            {
                var model = await _repairStatusService.GetAllAsync();

                return(View(model));
            }
            catch (Exception ex)
            {
                return(View("Error", ex));
            }
        }
示例#2
0
        public async Task <IActionResult> GetAll()
        {
            try
            {
                var model = await _repairStatusService.GetAllAsync();

                return(Ok(model));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
示例#3
0
        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");
        }