public async Task <IActionResult> Index() { var listOperation = await _bo.ListAsync(); if (!listOperation.Success) { return(OperationErrorBackToIndex(listOperation.Exception)); } var ipListOperation = await _ipbo.ListAsync(); if (!ipListOperation.Success) { return(OperationErrorBackToIndex(ipListOperation.Exception)); } var rListOperation = await _rbo.ListAsync(); if (!rListOperation.Success) { return(OperationErrorBackToIndex(rListOperation.Exception)); } var list = new List <ResultInterestPointViewModel>(); foreach (var item in listOperation.Result) { if (!item.IsDeleted) { list.Add(ResultInterestPointViewModel.Parse(item)); } } var ipList = new List <InterestPointViewModel>(); foreach (var item in ipListOperation.Result) { if (!item.IsDeleted) { ipList.Add(InterestPointViewModel.Parse(item)); } } var rList = new List <ResultViewModel>(); foreach (var item in rListOperation.Result) { if (!item.IsDeleted) { rList.Add(ResultViewModel.Parse(item)); } } ViewData["Title"] = "Result Interest Point "; ViewData["BreadCrumbs"] = GetCrumbs(); ViewData["DeleteHref"] = GetDeleteRef(); ViewBag.InterestPoints = ipList; ViewBag.Results = rList; return(View(list)); }
public async Task <IActionResult> Details(Guid?id) { if (id == null) { return(RecordNotFound()); } var getOperation = await _bo.ReadAsync((Guid)id); if (!getOperation.Success) { return(OperationErrorBackToIndex(getOperation.Exception)); } if (getOperation.Result == null) { return(RecordNotFound()); } var getIPOperation = await _ipbo.ReadAsync(getOperation.Result.InterestPointId); if (!getIPOperation.Success) { return(OperationErrorBackToIndex(getIPOperation.Exception)); } if (getIPOperation.Result == null) { return(RecordNotFound()); } var getVOperation = await _vbo.ReadAsync(getOperation.Result.VisitorId); if (!getVOperation.Success) { return(OperationErrorBackToIndex(getVOperation.Exception)); } if (getVOperation.Result == null) { return(RecordNotFound()); } var vm = FeedbackViewModel.Parse(getOperation.Result); ViewData["Title"] = "Feedbacks details"; var crumbs = GetCrumbs(); crumbs.Add(new BreadCrumb() { Action = "New", Controller = "Feedbacks", Icon = "fa-search", Text = "Detail" }); ViewData["InterestPoints"] = InterestPointViewModel.Parse(getIPOperation.Result); ViewData["Visitors"] = VisitorViewModel.Parse(getVOperation.Result); ViewData["BreadCrumbs"] = crumbs; return(View(vm)); }
public async Task <IActionResult> Create() { var ipListOperation = await _ipbo.ListAsync(); if (!ipListOperation.Success) { return(OperationErrorBackToIndex(ipListOperation.Exception)); } var ipList = new List <InterestPointViewModel>(); foreach (var ip in ipListOperation.Result) { if (!ip.IsDeleted) { var ipvm = InterestPointViewModel.Parse(ip); ipList.Add(ipvm); } ViewBag.InterestPoints = ipList.Select(icip => new SelectListItem() { Text = icip.Name, Value = icip.Id.ToString() }); } var cipListOperation = await _cipbo.ListAsync(); if (!cipListOperation.Success) { return(OperationErrorBackToIndex(cipListOperation.Exception)); } var cipList = new List <CategoryInterestPointViewModel>(); foreach (var cip in cipListOperation.Result) { if (!cip.IsDeleted) { var cipvm = CategoryInterestPointViewModel.Parse(cip); cipList.Add(cipvm); } ViewBag.CategoryInterestPoints = cipList.Select(icip => new SelectListItem() { Text = icip.Name, Value = icip.Id.ToString() }); } ViewData["Title"] = "New Interest Point Categories"; var crumbs = GetCrumbs(); crumbs.Add(new BreadCrumb() { Action = "New", Controller = "InterestPointsCategoryInterestPoints", Icon = "fa-plus", Text = "New" }); ViewData["BreadCrumbs"] = crumbs; return(View()); }
public async Task <IActionResult> Create() { var vListOperation = await _vbo.ListAsync(); if (!vListOperation.Success) { return(OperationErrorBackToIndex(vListOperation.Exception)); } var vList = new List <VisitorViewModel>(); foreach (var n in vListOperation.Result) { if (!n.IsDeleted) { var nvm = VisitorViewModel.Parse(n); vList.Add(nvm); } ViewBag.Visitors = vList.Select(ip => new SelectListItem() { Text = ip.FirstName, Value = ip.Id.ToString() }); } var ipListOperation = await _ipbo.ListAsync(); if (!ipListOperation.Success) { return(OperationErrorBackToIndex(vListOperation.Exception)); } var ipList = new List <InterestPointViewModel>(); foreach (var ip in ipListOperation.Result) { if (!ip.IsDeleted) { var ipvm = InterestPointViewModel.Parse(ip); ipList.Add(ipvm); } ViewBag.InterestPoints = ipList.Select(ip => new SelectListItem() { Text = ip.Name, Value = ip.Id.ToString() }); } ViewData["Title"] = "New Feedback"; var crumbs = GetCrumbs(); crumbs.Add(new BreadCrumb() { Action = "New", Controller = "Feedbacks", Icon = "fa-plus", Text = "New" }); ViewData["BreadCrumbs"] = crumbs; return(View()); }
public async Task <IActionResult> Edit(Guid?id) { if (id == null) { return(RecordNotFound()); } var getOperation = await _bo.ReadAsync((Guid)id); if (!getOperation.Success) { return(OperationErrorBackToIndex(getOperation.Exception)); } if (getOperation.Result == null) { return(RecordNotFound()); } var vm = InterestPointViewModel.Parse(getOperation.Result); var listCOperation = await _cbo.ListAsync(); if (!listCOperation.Success) { return(OperationErrorBackToIndex(listCOperation.Exception)); } var cList = new List <SelectListItem>(); foreach (var item in listCOperation.Result) { if (!item.IsDeleted) { var listItem = new SelectListItem() { Value = item.Id.ToString(), Text = item.Name }; if (item.Id == vm.CompanyId) { listItem.Selected = true; } cList.Add(listItem); } } ViewBag.Companies = cList; ViewData["Title"] = "Edit Interest Point"; var crumbs = GetCrumbs(); crumbs.Add(new BreadCrumb() { Action = "Edit", Controller = "InterestPoints", Icon = "fa-edit", Text = "Edit" }); ViewData["BreadCrumbs"] = crumbs; return(View(vm)); }
public ActionResult <List <InterestPointViewModel> > List() { var res = _bo.List(); if (!res.Success) { return(new ObjectResult(HttpStatusCode.InternalServerError)); } var list = new List <InterestPointViewModel>(); foreach (var item in res.Result) { list.Add(InterestPointViewModel.Parse(item)); } return(list); }
public ActionResult <InterestPointViewModel> Get(Guid id) { var res = _bo.Read(id); if (res.Success) { if (res.Result == null) { return(NotFound()); } var cvm = InterestPointViewModel.Parse(res.Result); return(cvm); } else { return(new ObjectResult(HttpStatusCode.InternalServerError)); } }
public async Task <IActionResult> Index() { var listOperation = await _bo.ListAsync(); if (!listOperation.Success) { return(OperationErrorBackToIndex(listOperation.Exception)); } var cListOperation = await _cbo.ListAsync(); if (!cListOperation.Success) { return(OperationErrorBackToIndex(cListOperation.Exception)); } var list = new List <InterestPointViewModel>(); foreach (var item in listOperation.Result) { if (!item.IsDeleted) { list.Add(InterestPointViewModel.Parse(item)); } } var cList = new List <CompanyViewModel>(); foreach (var item in cListOperation.Result) { if (!item.IsDeleted) { cList.Add(CompanyViewModel.Parse(item)); } } ViewData["Title"] = "Interest Points"; ViewData["BreadCrumbs"] = GetCrumbs(); ViewData["DeleteHref"] = GetDeleteRef(); ViewBag.Companies = cList; return(View(list)); }