public ActionResult GetAllFixOrder() { List <FixOrderDto> list1 = new List <FixOrderDto>(); var finishedCount = 0; var allCount = 0; var dc = _fixOrderServices.GetAll().OrderByDescending(x => x.Id); foreach (var item in dc) { item.moshrefname = _userService.GetById((Guid)item.moshId).FullName.ToString(); item.HosterName = _userService.GetById((Guid)item.Hoster).FullName.ToString(); if (item.maitremp == null) { item.empName = "لم يتم أرسالها الى الموظف بعد "; } else { item.empName = _userService.GetById((Guid)item.maitremp).FullName.ToString(); } item.Roomnu = _roomService.GetById((int)item.Room_ID).RoomNum.ToString(); if (item.isFinished) { finishedCount++; } list1.Add(item); allCount++; } ViewBag.FixFinishedCount = ((finishedCount * 100) / allCount) + " %"; return(View(list1)); }
public double GetNotFinishedPercentageForFixer() { var allFixOrders = _fixOrderService.GetAll(); var percentage = (allFixOrders.Where(x => x.isFinished).Count() * 100) / allFixOrders.Count(); return(percentage); }