public ActionResult Detail(int?Id) { var DotQGCDBHXH = DotGQCDBHXHRepository.GetDotGQCDBHXHById(Id.Value); var detail = DotGQCDBHXHDetailRepository.GetAllvwDotGQCDBHXHDetail().Where(u => u.DotGQCDBHXHId == DotQGCDBHXH.Id).ToList(); if (DotQGCDBHXH != null && DotQGCDBHXH.IsDeleted != true) { var model = new DotGQCDBHXHViewModel(); model.ListDotGQCDBHXHDetail = new List <DotGQCDBHXHDetailViewModel>(); AutoMapper.Mapper.Map(DotQGCDBHXH, model); foreach (var item in detail) { var detailModel = new DotGQCDBHXHDetailViewModel(); AutoMapper.Mapper.Map(item, detailModel); model.ListDotGQCDBHXHDetail.Add(detailModel); } if (model.CreatedUserId != Helpers.Common.CurrentUser.Id && Helpers.Common.CurrentUser.UserTypeId != 1) { TempData["FailedMessage"] = "NotOwner"; return(RedirectToAction("Index")); } return(View(model)); } if (Request.UrlReferrer != null) { return(Redirect(Request.UrlReferrer.AbsoluteUri)); } return(RedirectToAction("Index")); }
public ActionResult Edit(DotGQCDBHXHDetailViewModel model, bool IsPopup) { if (ModelState.IsValid) { if (Request["Submit"] == "Save") { var DotGQCDBHXHDetail = DotGQCDBHXHDetailRepository.GetDotGQCDBHXHDetailById(model.Id); AutoMapper.Mapper.Map(model, DotGQCDBHXHDetail); DotGQCDBHXHDetail.ModifiedUserId = WebSecurity.CurrentUserId; DotGQCDBHXHDetail.ModifiedDate = DateTime.Now; DotGQCDBHXHDetailRepository.UpdateDotGQCDBHXHDetail(DotGQCDBHXHDetail); if (IsPopup) { return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" })); } else { TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.UpdateSuccess; return(RedirectToAction("Index")); } } return(View(model)); } return(View(model)); //if (Request.UrlReferrer != null) // return Redirect(Request.UrlReferrer.AbsoluteUri); //return RedirectToAction("Index"); }
public ActionResult Create(DotGQCDBHXHDetailViewModel model) { if (ModelState.IsValid) { var DotGQCDBHXHDetail = new DotGQCDBHXHDetail(); AutoMapper.Mapper.Map(model, DotGQCDBHXHDetail); DotGQCDBHXHDetail.IsDeleted = false; DotGQCDBHXHDetail.CreatedUserId = WebSecurity.CurrentUserId; DotGQCDBHXHDetail.ModifiedUserId = WebSecurity.CurrentUserId; DotGQCDBHXHDetail.AssignedUserId = WebSecurity.CurrentUserId; DotGQCDBHXHDetail.CreatedDate = DateTime.Now; DotGQCDBHXHDetail.ModifiedDate = DateTime.Now; DotGQCDBHXHDetailRepository.InsertDotGQCDBHXHDetail(DotGQCDBHXHDetail); TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess; return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Edit(int?Id) { var DotGQCDBHXHDetail = DotGQCDBHXHDetailRepository.GetvwDotGQCDBHXHDetailById(Id.Value); if (DotGQCDBHXHDetail != null && DotGQCDBHXHDetail.IsDeleted != true) { var model = new DotGQCDBHXHDetailViewModel(); AutoMapper.Mapper.Map(DotGQCDBHXHDetail, model); if (model.CreatedUserId != Helpers.Common.CurrentUser.Id && Helpers.Common.CurrentUser.UserTypeId != 1) { TempData["FailedMessage"] = "NotOwner"; return(RedirectToAction("Index")); } return(View(model)); } if (Request.UrlReferrer != null) { return(Redirect(Request.UrlReferrer.AbsoluteUri)); } return(RedirectToAction("Index")); }
public ViewResult Create() { var model = new DotGQCDBHXHDetailViewModel(); return(View(model)); }