/// <summary> /// Function to update information about a entity . /// </summary> /// <param name="id">entity's id</param> /// <param name="param">entity</param> /// <returns>response and update entity</returns> public ApiResponse Update(long id, AccountParam param) { ApiResponse response = new ApiResponse(); try { Processor.Update(id, param); response.Result = true; response.Text = "The entity updated successfully . \n"; return(response); } catch (Exception ex) { response.Result = false; response.Text = ex.Message; return(response); } }
public Response Update(long id, AccountParam param) { Response response = new Response(); try { Processor.Update(id, param); response.Text = "The entity has been updated."; response.Result = true; } catch (InvalidOperationException) { response.Text = $"Entity status with id: {param.StatusId} (or user id: {param.UserId}) does not exist, therefore the update cannot execute."; response.Result = false; } catch (NullReferenceException) { response.Text = $"Entity with id: {id} does not exist, therefore there is nothing to update."; response.Result = false; } return(response); }
public ApiResponse Update(long id, AccountParam param) { AccountProcessor = new AccountProcessor(); Response = new ApiResponse(); try { AccountProcessor.Update(id, param); Response.text = "Entity was successfully updated"; Response.result = true; return(Response); } catch (Exception e) { Response.text = "Unfortunately something went wrong :(" + e; Response.result = false; return(Response); } }