public async Task <JsonResult> GetAllByCompany() { try { var list = _shiftService.GetAll().Result.ToList(); list = ShiftUtility.FilterByIsArchived(list, false); list = ShiftUtility.FilterByCompanyID(CurrentUser.CompanyID, list); return(Json(new { success = true, data = ShiftUtility.MsToVMs(list) }, JsonRequestBehavior.AllowGet)); } catch { return(Json(new { success = false }, JsonRequestBehavior.AllowGet)); } }
public async Task <IActionResult> GetALL() { _logger.LogInformation("Petición de listado de turnos recibida"); var result = await _shiftService.GetAll(); _logger.LogInformation("Listado de turnos retornado "); return(Ok(result)); }
public ActionResult <IEnumerable <Shift> > GetCgiShift() { try { return(Ok(_shiftService.GetAll())); } catch (Exception e) { return(BadRequest(new { message = e.Message })); } }
/// <summary> /// Prepare paged shift list model /// </summary> /// <param name="searchModel">Shift search model</param> /// <returns>Shift list model</returns> public virtual ShiftListModel PrepareShiftListModel(ShiftSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } var entities = _shiftService.GetAll(name: searchModel.SearchName, pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize, showHidden: true); var model = new ShiftListModel { Data = entities.PaginationByRequestModel(searchModel).Select(s => s.ToModel <ShiftModel>()), Total = entities.TotalCount }; return(model); }