public async Task <BaseResponse> LocationRemove(LocationRemoveRequest request) { BaseResponse response = new BaseResponse(); try { var user = await _context.GetCurrentCustomer(); var command = request.ToCommandRemove(user.Id); var result = await _locationService.SendCommand(command); if (result.IsSucess) { response.SetSucess(); } else { response.SetFail(result.Message); } } catch (Exception e) { response.SetFail(e); _logger.LogError(e, e.Message, request); } return(response); }
public async Task <IActionResult> Delete([FromBody] LocationRemoveRequest request) { try { var response = new BaseResponse(); response = await _locationAppService.LocationRemove(request); return(Json(response)); } catch (Exception e) { _logger.LogError(e, Common.Common.GetMethodName(), request); throw; } }
public static LocationRemoveCommand ToCommandRemove(this LocationRemoveRequest command, string userId) { if (command == null) { return(null); } return(new LocationRemoveCommand() { ProvinceId = command.ProvinceId, DistricId = command.DistricId, WardId = command.WardId, StreetId = command.StreetId, UpdatedUid = userId, UpdatedDateUtc = Extensions.GetCurrentDateUtc(), TypeLocation = command.TypeLocation }); }