示例#1
0
        public IHttpActionResult DeleteMasterDirectionIndexAmendment(DeleteMasterDirectionIndexAmendmentRequest deleteMasterDirectionIndexAmendmentRequest)
        {
            var responses = new Responses();

            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                if (Utility.UserId < 0)
                {
                    return(BadRequest(Utility.INVALID_USER));
                }

                var masterDirectionIndexAmendment = new MasterDirectionIndexAmendment()
                {
                    MasterDirectionIndexAmendmentId = deleteMasterDirectionIndexAmendmentRequest.MasterDirectionIndexAmendmentId,
                    ModifiedBy = Utility.UserId
                };

                int result = iMasterDirectionIndexAmendment.DeleteMasterDirectionIndexAmendment(masterDirectionIndexAmendment);
                switch (result)
                {
                case 1:
                    responses.Status      = Utility.SUCCESS_STATUS_RESPONSE;
                    responses.Description = "MasterDirectionIndexAmendment deleted successfully.";
                    break;

                case -2:
                    responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                    responses.Description = "MasterDirectionIndexAmendment doesn't exist.";
                    break;

                default:
                    responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                    responses.Description = "Error while deleting MasterDirectionIndexAmendment.";
                    break;
                }
            }
            catch (Exception ex)
            {
                responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                responses.Description = "Error while deleting MasterDirectionIndexAmendment.";

                Utility.WriteLog("DeleteMasterDirectionIndexAmendment", deleteMasterDirectionIndexAmendmentRequest, "Error while deleting MasterDirectionIndexAmendment. (MasterDirectionIndexAmendmentAdminController)", ex.ToString());
            }
            return(Ok(responses));
        }