public async Task <IHttpActionResult> Update([FromBody] IIpUser user) { var usr = await _user.GetByIdAsync(user.Id); if (usr == null) { return(NotFound()); } var result = await usr.UpdateAsync(user); return(Ok()); }
/// <summary> /// Updates an existing user /// </summary> /// <param name="user">The IIpUser object to update</param> /// <returns>A response based on the update</returns> public virtual IIpResponse Update(IIpUser user) { var validUser = ValidateUser(user); if (validUser != IpUserEditStatus.Success) { return(new IpResponse { Status = (int)validUser, ResponseMessage = validUser.ToDescription() }); } return(new IpResponse()); }
/// <summary> /// Default Constructor /// </summary> public IpUserController() { _user = new IpUser(); }
/// <summary> /// Checks that the user is valid /// </summary> /// <param name="user">The user</param> /// <returns>A status object indicting success/fail</returns> protected virtual IpUserEditStatus ValidateUser(IIpUser user) { //TODO: Validate the email, username, etc... return(IpUserEditStatus.Success); }
/// <summary> /// Updates an existing user /// </summary> /// <param name="user">The IIpUser object to update</param> /// <returns>A response based on the update</returns> public async virtual Task <IIpResponse> UpdateAsync(IIpUser user) { return(await Task.Run(() => Update(user))); }