public IActionResult Add(Staff staff) { var result = staffManager.Add(staff); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public ActionResult Add(Staff staff) { if (StaffService.Add(staff)) { return(Redirect("Index")); } else { return(Content("no")); } }
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)); } }
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())); }
public ActionResult Create(Staff model) { try { if (ModelState.IsValid) { staffService.Add(model); return(RedirectToAction("Index")); } else { return(RedirectToAction("Index")); } } catch { return(RedirectToAction("Index")); } }
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))); }
public async Task <dynamic> AddStaff([FromBody] DatabaseModel.Staff staff) { return(await _staffService.Add(staff)); }
public ActionResult AddStaff(Staff staff) { _staffManager.Add(staff); return(View()); }
public void Add(StaffInfo obj) { _service.Add(obj); }