public IActionResult Add(Staff staff)
        {
            var result = staffManager.Add(staff);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
예제 #2
0
 public ActionResult Add(Staff staff)
 {
     if (StaffService.Add(staff))
     {
         return(Redirect("Index"));
     }
     else
     {
         return(Content("no"));
     }
 }
예제 #3
0
 public JsonResult Add(Staff staff)
 {
     if (StaffService.Add(staff))
     {
         LogHandler.WriteServiceLog("虚拟用户", "Id:" + staff.Id + ",Name:" + staff.Name, "成功", "创建", "样例程序");
         return(Json(1, JsonRequestBehavior.AllowGet));
     }
     else
     {
         LogHandler.WriteServiceLog("虚拟用户", "Id:" + staff.Id + ",Name:" + staff.Name, "失败", "创建", "样例程序");
         return(Json(0, JsonRequestBehavior.AllowGet));
     }
 }
예제 #4
0
        public void StaffServiceShouldAddNewStaff()
        {
            var _newStaff = new Staff()
            {
                FirstName = "Luke",
                LastName  = "Wu",
                BirthDate = DateTime.Parse("1987-09-25")
            };

            int maxStaffNo = _staffs.Max(s => s.StaffNo);

            _newStaff.StaffNo = maxStaffNo + 1;
            _staffService.Add(_newStaff);

            Assert.That(_newStaff, Is.EqualTo(_staffs.Last()));
        }
예제 #5
0
 public ActionResult Create(Staff model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             staffService.Add(model);
             return(RedirectToAction("Index"));
         }
         else
         {
             return(RedirectToAction("Index"));
         }
     }
     catch
     {
         return(RedirectToAction("Index"));
     }
 }
예제 #6
0
        public async Task <Result <string> > Modify(StaffDto dto, string staffopt)
        {
            var request = Request.Form;

            if (staffopt == "add")
            {
                dto.CreateDate = DateTime.Now;
                dto.Status     = AccountStatus.Normal;
                dto.Password   = Hx.Security.Md5Getter.Get(dto.Password);
                return(await Task.Run(() => _staffService.Add(dto, dto.OrgId, LoginInfo.Role)));
            }
            var newPwd = request["NewPassWord"].ToString();

            if (newPwd.IsNotNullOrEmpty())
            {
                dto.Password = request["NewPassWord"];
                dto.Password = Hx.Security.Md5Getter.Get(dto.Password);
            }
            return(await Task.Run(() => _staffService.Update(dto)));
        }
예제 #7
0
 public async Task <dynamic> AddStaff([FromBody] DatabaseModel.Staff staff)
 {
     return(await _staffService.Add(staff));
 }
예제 #8
0
 public ActionResult AddStaff(Staff staff)
 {
     _staffManager.Add(staff);
     return(View());
 }
 public void Add(StaffInfo obj)
 {
     _service.Add(obj);
 }