public async Task <IActionResult> Post([FromBody] AdminRequest request) { await _ethereumClient.WaitForConfirmationAsync(request.TransactionHash); await _adminService.AddAsync(request.Address); return(NoContent()); }
/// <summary> /// 添加管理员 /// </summary> /// <param name="model">管理员实体</param> /// <returns></returns> public async Task <int> InsertAdmin(AdminDto model) { return(await _service.AddAsync(new Admin() { AdminName = model.AdminName, AdminPassword = model.AdminPassword, RolesId = model.RolesId, ImagePath = model.ImagePath })); }
public async Task <IActionResult> CreateAdminAsync([FromBody] CreateAdmin command) { var adminTuple = await _adminService.AddAsync(command); var adminDto = _mapper.Map <AdminDto>(adminTuple.Admin); adminDto.Login = adminTuple.Login; return(Created($"{Request.Host}{Request.Path}/{adminTuple.Admin.Id}", adminDto)); }
public async Task <IActionResult> Add(string name, string mobile, string password) { if (string.IsNullOrEmpty(name)) { return(Json(new AjaxResult { Status = 0, Msg = "管理员账号不能为空" })); } if (!Regex.IsMatch(mobile, @"^1\d{10}$")) { return(Json(new AjaxResult { Status = 0, Msg = "管理员手机号格式不正确" })); } if (string.IsNullOrEmpty(password)) { return(Json(new AjaxResult { Status = 0, Msg = "管理员密码不能为空" })); } long id = await adminService.AddAsync(name, mobile, null, password); if (id <= 0) { if (id == -1) { return(Json(new AjaxResult { Status = 0, Msg = "管理员账号已经存在" })); } if (id == -2) { return(Json(new AjaxResult { Status = 0, Msg = "管理员手机号已经存在" })); } return(Json(new AjaxResult { Status = 0, Msg = "添加管理员失败" })); } return(Json(new AjaxResult { Status = 1, Msg = "添加管理员成功", Data = "/admin/admin/list" })); }
public async Task <ActionResult <Admin> > AddAsync([FromBody] User user) { var item = await _adminService.AddAsync(user); return(CreatedAtAction(nameof(GetByIdAsync), new { id = item.Id }, item)); }
public async Task <IActionResult> Add([FromBody] AdminAddUser model) { await _adminService.AddAsync(model); return(Ok()); }