Ejemplo n.º 1
0
        public ActionResult Create(StaffFamilyViewModel model)
        {
            if (ModelState.IsValid)
            {
                var StaffFamily = new Domain.Staff.Entities.StaffFamily();
                AutoMapper.Mapper.Map(model, StaffFamily);
                StaffFamily.IsDeleted      = false;
                StaffFamily.CreatedUserId  = WebSecurity.CurrentUserId;
                StaffFamily.ModifiedUserId = WebSecurity.CurrentUserId;
                StaffFamily.CreatedDate    = DateTime.Now;
                StaffFamily.ModifiedDate   = DateTime.Now;
                StaffFamilyRepository.InsertStaffFamily(StaffFamily);

                if (Request["IsPopup"] == "true" || Request["IsPopup"] == "True")
                {
                    ViewBag.closePopup = "true";
                    model.Id           = StaffFamily.Id;
                    //model.GenderList = Helpers.SelectListHelper.GetSelectList_Gender(null);
                    //model.CorrelativeList = Helpers.SelectListHelper.GetSelectList_Category("Correlative", null, "Name", App_GlobalResources.Wording.Empty);
                    return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" }));
                    //return View(model);
                }

                TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess;
                return(RedirectToAction("Detail", "Staffs", new { area = "Staff", Id = model.StaffId }));
            }
            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult CreateListFamily(StaffFamilyViewModel model)
        {
            if (ModelState.IsValid)
            {
                var StaffFamily = new Domain.Staff.Entities.StaffFamily();
                AutoMapper.Mapper.Map(model, StaffFamily);
                StaffFamily.IsDeleted      = false;
                StaffFamily.CreatedUserId  = WebSecurity.CurrentUserId;
                StaffFamily.ModifiedUserId = WebSecurity.CurrentUserId;
                StaffFamily.CreatedDate    = DateTime.Now;
                StaffFamily.ModifiedDate   = DateTime.Now;
                StaffFamilyRepository.InsertStaffFamily(StaffFamily);

                if (Request["IsPopup"] == "true" || Request["IsPopup"] == "True")
                {
                    ViewBag.closePopup = "true";
                    model.Id           = StaffFamily.Id;

                    return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" }));
                }
            }
            return(View(model));
        }