コード例 #1
0
        //[AuthorizeUser(ModuleName = "Employee", AccessLevel = Constants.Edit)]
        public ActionResult EditDispatchType(int?id)
        {
            DispatchTypeEntity entity = new DispatchTypeEntity();

            if (id != null)
            {
                entity = _ipldispatchtype.ViewDetail((int)id);
            }
            return(View("CreateDispatchType", entity));
        }
コード例 #2
0
        public ActionResult Save(DispatchTypeEntity model)
        {
            var entity = new DispatchTypeEntity();

            //if (ModelState.IsValid)
            //{
            if (model.Id > 0)
            {
                var sess = SessionSystem.GetUser();
                Logs.logs("Sửa Loại công văn", "Truy cập vào trang DispatchType", "/DispatchType/CreateDispatchType", sess.UserId);
                entity = _ipldispatchtype.ViewDetail(model.Id);

                if (entity != null && entity.Id > 0)
                {
                    entity.Name = model.Name;

                    var retVal = _ipldispatchtype.Update(entity);
                    if (retVal)
                    {
                        return(RedirectToAction("Index", "DispatchType"));
                    }
                }
            }
            else
            {
                var sess = SessionSystem.GetUser();
                Logs.logs("Thêm mới Loại công văn", "Truy cập vào trang DispatchType", "/DispatchType/CreateDispatchType", sess.UserId);
                model.Createdate = DateTime.Now;
                var empId = _ipldispatchtype.Insert(model);
                if (empId > 0)
                {
                    return(RedirectToAction("Index", "DispatchType", new { id = empId }));
                }
            }
            //}
            ViewBag.Msg = ConstantMsg.ErrorProgress;
            return(View("DispatchType", model));
        }
コード例 #3
0
 //[AuthorizeUser(ModuleName = "Department", AccessLevel = Constants.Add)]
 public ActionResult CreateDispatchType(DispatchTypeEntity entity)
 {
     return(View(entity));
 }