public ActionResult DBToJsonExe() { JsonManager <Executor> jman = new JsonManager <Executor>(); jman.SaveToFile(_exeManager.GetAll(), directoryDBToJson, "ExecutorsFromDB"); Response.ContentType = "Application/json"; Response.AppendHeader("Content-Disposition", "attachment; filename=ExecutorsFromDB.json"); Response.TransmitFile(Server.MapPath("~/ConvertFiles/JsonsFromDB/ExecutorsFromDB.json")); Response.End(); return(View("Index")); }
public bool Delete(string serviceid) { try { List <Executor> executors = _exeManager.GetAll().Where(x => x.ServiceIndustryId == serviceid).ToList(); _unitOfWork.ServRepos.Delete(_unitOfWork.ServRepos.GetAll().Find(x => x.ServiceIndustryId == serviceid)); DeleteExecutors(executors); //ServiceIndustry service = _unitOfWork.ServRepos.GetAll().Find(s => s.ServiceIndustryId == serviceid); //remove service //DeleteExecutors(_exeManager.Get().FindAll(e => e.ServiceIndustryId == serviceid)); //_unitOfWork.ServRepos.Delete(service); _unitOfWork.Save(); return(true); } catch (Exception e) { } return(false); }
public ActionResult Index(string option, string search, int?pageNumber, SortStateExe sortOrder = SortStateExe.TimeAsc) { if (!_exeManager.GetAll().Any()) { return(RedirectToAction("NoExecutorsYet")); } else { IEnumerable <Executor> executors = _exeManager.GetAll(); if (search != null) { executors = _exeManager.Search(executors, option, search); } ViewData["TimeSort"] = sortOrder == SortStateExe.TimeAsc ? SortStateExe.TimeDesc : SortStateExe.TimeAsc; ViewData["PriceSort"] = sortOrder == SortStateExe.PriceAsc ? SortStateExe.PriceDesc : SortStateExe.PriceAsc; ViewData["CustomerSort"] = sortOrder == SortStateExe.CustomerAsc ? SortStateExe.CustomerDesc : SortStateExe.CustomerAsc; ViewData["ServiceIndustrySort"] = sortOrder == SortStateExe.ServiceIndustryAsc ? SortStateExe.ServiceIndustryDesc : SortStateExe.ServiceIndustryAsc; return(View(_exeManager.Sort(executors, sortOrder).ToPagedList(pageNumber ?? 1, 10))); } }