public ActionResult _Create(int?id, int DocTypeId) { PersonViewModel p = new PersonViewModel(); p.IsActive = true; p.DocTypeId = DocTypeId; ViewBag.Name = new DocumentTypeService(_unitOfWork).Find(DocTypeId).DocumentTypeName; if (id != null && id != 0) { p = GetPersonViewModel((int)id); } else { p.Code = new PersonService(_unitOfWork).GetMaxCode(); p.Suffix = new PersonService(_unitOfWork).GetMaxCode(); } var settings = new PersonSettingsService(_unitOfWork).GetPersonSettingsForDocument(DocTypeId); p.DivisionIds = System.Web.HttpContext.Current.Session["DivisionId"].ToString(); p.SiteIds = System.Web.HttpContext.Current.Session["SiteId"].ToString(); p.LedgerAccountGroupId = settings.LedgerAccountGroupId; return(PartialView("_Create", p)); }
// GET: /PersonSettingMaster/Create public ActionResult Create(int id)//DocTypeId { if (!UserRoles.Contains("SysAdmin")) { return(View("~/Views/Shared/InValidSettings.cshtml")); } var settings = new PersonSettingsService(_unitOfWork).GetPersonSettings(id); if (settings == null) { PersonSettingsViewModel vm = new PersonSettingsViewModel(); vm.DocTypeName = new DocumentTypeService(_unitOfWork).Find(id).DocumentTypeName; vm.DocTypeId = id; PrepareViewBag(vm); return(View("Create", vm)); } else { PersonSettingsViewModel temp = AutoMapper.Mapper.Map <PersonSettings, PersonSettingsViewModel>(settings); temp.DocTypeName = new DocumentTypeService(_unitOfWork).Find(id).DocumentTypeName; PrepareViewBag(temp); return(View("Create", temp)); } }