public Boolean UpdateActivityStatus(Guid userId, Int32 currentStatus) { _logger.LogInfo($"Supplier method '{nameof(UpdateActivityStatus)}({userId}, {currentStatus})' is called"); CActivityStatusDto activityStatus = new CActivityStatusDto(userId, currentStatus); return(_service.UpdateActivityStatus(activityStatus)); }
public IHttpActionResult UpdateActivityStatus([FromBody] CActivityStatusDto currentStatus) { s_log.LogInfo($"{System.Reflection.MethodBase.GetCurrentMethod()}({currentStatus}) is called"); if (currentStatus == null) { s_log.LogError($"{System.Reflection.MethodBase.GetCurrentMethod()}({(CActivityStatusDto)null})", new ArgumentNullException(nameof(currentStatus), "Incoming data is null")); ModelState.AddModelError($"{nameof(currentStatus)}", "Incoming data is null"); return(BadRequest(ModelState)); } Int32 result = _userDataProvider.UpdateUserStatus(currentStatus.UserId, currentStatus.ActivityStatus); if (result == 0) { s_log.LogError($"{System.Reflection.MethodBase.GetCurrentMethod()}({currentStatus})", new Exception("Failed to update user status")); return(NotFound()); } return(Ok(true)); }
public Boolean UpdateActivityStatus(CActivityStatusDto activityStatus) { Console.WriteLine($@"Service method '{nameof(UpdateActivityStatus)}({activityStatus})' is called"); _logger.LogInfo($"Service method '{nameof(UpdateActivityStatus)}({activityStatus})' is called"); try { HttpResponseMessage response = _client.PostAsync( $"api/user/activityStatus", new StringContent(JsonConvert.SerializeObject(activityStatus), Encoding.UTF8, "application/json") ).Result; return((response.IsSuccessStatusCode) ? response.Content.ReadAsAsync <Boolean>().Result : false); } catch (Exception e) { Console.WriteLine(e); throw; } }