public ViewResult ListMyRequests() { Employee currEmployee = ldapService.GetUserEmployee(); ViewBag.Title = "Мои заявки"; List <Request> requests = repository.Requests.Where(r => r.AuthorID == currEmployee.EmployeeID).ToList(); return(View("List", requests)); }
public void AddRow(IHistoryable obj, string text) { if (obj.History == null) { obj.History = new List <HistoryRow>(); } string historyText = Regex.Replace(text, "<.*?>", string.Empty); obj.History.Add(new HistoryRow() { AuthorEmployeeID = ldapService.GetUserEmployee().EmployeeID, Date = DateTime.Now, Text = historyText }); context.SaveChanges(); }
public IActionResult Index() { int currEmployeeId = ldapService.GetUserEmployee().EmployeeID; if (requestRepository.Requests .Any(r => r.State == RequestState.Approving && r.Details.Any(d => d.ResourceOwnerID == currEmployeeId && d.ApprovingResult == ResourceApprovingResult.None))) { return(RedirectToAction("ListToApprove", "Request")); } else if (User.IsInRole("Admins")) { return(RedirectToAction("List", "Resource")); } else { return(RedirectToAction("ListMyRequests", "Request")); } }