Example #1
0
        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());
        }
Example #2
0
        /// <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());
        }
Example #3
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 public IpUserController()
 {
     _user = new IpUser();
 }
Example #4
0
 /// <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);
 }
Example #5
0
 /// <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)));
 }