Пример #1
0
 public void Patch(string id, [FromBody] MergePatchFacilityDto value)
 {
     try {
         FacilitiesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
         _facilityApplicationService.When(value as IMergePatchFacility);
     } catch (Exception ex) { var response = FacilitiesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Пример #2
0
 public void Delete(string id, string commandId, string version, string requesterId = default(string))
 {
     try {
         var value = new DeleteFacilityDto();
         value.CommandId   = commandId;
         value.RequesterId = requesterId;
         value.Version     = (long)Convert.ChangeType(version, typeof(long));
         FacilitiesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
         _facilityApplicationService.When(value as IDeleteFacility);
     } catch (Exception ex) { var response = FacilitiesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }
Пример #3
0
        public void Put(string id, [FromBody] CreateOrMergePatchOrDeleteFacilityDto value)
        {
            try {
                // ///////////////////////////////
                if (value.Version != default(long))
                {
                    value.CommandType = CommandType.MergePatch;
                    FacilitiesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
                    _facilityApplicationService.When(value as IMergePatchFacility);
                    return;
                }
                // ///////////////////////////////

                FacilitiesControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value);
                _facilityApplicationService.When(value as ICreateFacility);
            } catch (Exception ex) { var response = FacilitiesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
        }