public void Patch(string id, [FromBody] MergePatchLocatorDto value) { try { LocatorsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _locatorApplicationService.When(value as IMergePatchLocator); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void Delete(string id, string commandId, string version, string requesterId = default(string)) { try { var value = new DeleteLocatorDto(); value.CommandId = commandId; value.RequesterId = requesterId; value.Version = (long)Convert.ChangeType(version, typeof(long)); LocatorsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _locatorApplicationService.When(value as IDeleteLocator); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteLocatorDto value) { try { // /////////////////////////////// if (value.Version != default(long)) { value.CommandType = CommandType.MergePatch; LocatorsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _locatorApplicationService.When(value as IMergePatchLocator); return; } // /////////////////////////////// LocatorsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _locatorApplicationService.When(value as ICreateLocator); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }