コード例 #1
0
ファイル: StaffController.cs プロジェクト: EricCode1983/GMS
        public ActionResult Create(FormCollection collection)
        {
            var model = new Staff();
            this.TryUpdateModel<Staff>(model);

            this.OAService.SaveStaff(model);

            return this.RefreshParent();
        }
コード例 #2
0
ファイル: StaffController.cs プロジェクト: shenxingfu/HaoTang
        //
        // GET: /OA/Staff/Create

        public ActionResult Create()
        {
            var Branchlist = this.OAService.GetBranchList(new BranchRequest());
            this.ViewBag.BranchId = new SelectList(Branchlist, "ID", "Name");

            var model = new Staff() { };
            this.RenderMyViewData(model);
            return View("Edit", model);
        }
コード例 #3
0
ファイル: OAService.cs プロジェクト: EricCode1983/GMS
        public void SaveStaff(Staff staff)
        {
            using (var dbContext = new OADbContext())
            {

                if (staff.ID > 0)
                {
                    dbContext.Update<Staff>(staff);
                }
                else
                {
                    dbContext.Insert<Staff>(staff);
                }
            }
        }
コード例 #4
0
ファイル: StaffController.cs プロジェクト: EricCode1983/GMS
 private void RenderMyViewData(Staff model)
 {
     ViewData.Add("Position", new SelectList(EnumHelper.GetItemValueList<EnumPosition>(), "Key", "Value", model.Position));
     ViewData.Add("Gender", new SelectList(EnumHelper.GetItemValueList<EnumGender>(), "Key", "Value", model.Gender));
 }
コード例 #5
0
ファイル: StaffController.cs プロジェクト: EricCode1983/GMS
        //
        // GET: /OA/Staff/Create

        public ActionResult Create()
        {
            var model = new Staff() { };
            this.RenderMyViewData(model);
            return View("Edit", model);
        }