예제 #1
0
        public ActionResult AssignPositionAdd(AssignPositionActionView model)
        {
            try
            {
                HttpCookie         reqCookies = Request.Cookies["StaffLoginCookie"];
                ResponseStaffLogin login      = JsonConvert.DeserializeObject <ResponseStaffLogin>(reqCookies.Value.ToString().UrlDecode());

                if (ModelState.IsValid)
                {
                    model.ActionBy = login.Account;
                    if (_assignPosition.Add(model))
                    {
                        _assignPosition.Save();
                        return(Redirect("/Staff/AssignPosition"));
                    }
                }
                ViewBag.PositionList   = _positionBusiness.GetAll();
                ViewBag.StaffList      = _staffBusiness.GetAll();
                ViewBag.DepartmentList = _departmentBusiness.GetAll();
                return(View(model));
            }
            catch (Exception)
            {
                ViewBag.PositionList   = _positionBusiness.GetAll();
                ViewBag.StaffList      = _staffBusiness.GetAll();
                ViewBag.DepartmentList = _departmentBusiness.GetAll();
                return(View(model));
            }
        }
예제 #2
0
 public bool Add(AssignPositionActionView model)
 {
     try
     {
         AssignPosition assignPosition = new AssignPosition();
         assignPosition.CreateBy     = model.ActionBy;
         assignPosition.CreateDate   = DateTime.Now;
         assignPosition.DepartmentID = model.DepartmentID;
         assignPosition.Desc         = model.Desc;
         assignPosition.ModifyBy     = model.ActionBy;
         assignPosition.ModifyDate   = DateTime.Now;
         assignPosition.PositionID   = model.PositionID;
         assignPosition.StaffID      = model.StaffID;
         assignPosition.Status       = model.Status;
         DbContext.AssignPositions.Add(assignPosition);
         return(true);
     }
     catch (System.Exception)
     {
         return(false);
     }
 }
예제 #3
0
 public bool Add(AssignPositionActionView model)
 {
     return(_assignPosition.Add(model));
 }