示例#1
0
        public IHttpActionResult UpdateMasterDirectionIndexAmendment(UpdateMasterDirectionIndexAmendmentRequest updateMasterDirectionIndexAmendmentRequest)
        {
            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 = updateMasterDirectionIndexAmendmentRequest.MasterDirectionIndexAmendmentId,
                    MasterDirectionId         = updateMasterDirectionIndexAmendmentRequest.MasterDirectionId,
                    APDIRCircularIds          = updateMasterDirectionIndexAmendmentRequest.APDIRCircularIds,
                    NotificationIds           = updateMasterDirectionIndexAmendmentRequest.NotificationIds,
                    MasterDirectionChapterId  = updateMasterDirectionIndexAmendmentRequest.MasterDirectionChapterId,
                    MasterDirectionIndexId    = updateMasterDirectionIndexAmendmentRequest.MasterDirectionIndexId,
                    MasterDirectionSubIndexId = updateMasterDirectionIndexAmendmentRequest.MasterDirectionSubIndexId,
                    IndexAmendmentContent     = updateMasterDirectionIndexAmendmentRequest.IndexAmendmentContent,
                    Year = updateMasterDirectionIndexAmendmentRequest.Year,
                    UpdatedInsertedByRBI     = updateMasterDirectionIndexAmendmentRequest.UpdatedInsertedByRBI,
                    UpdatedInsertedDateByRBI = updateMasterDirectionIndexAmendmentRequest.UpdatedInsertedDateByRBI,
                    ModifiedBy = Utility.UserId
                };
                int result = iMasterDirectionIndexAmendment.UpdateMasterDirectionIndexAmendment(masterDirectionIndexAmendment);

                switch (result)
                {
                case 1:
                    responses.Status      = Utility.SUCCESS_STATUS_RESPONSE;
                    responses.Description = "MasterDirectionIndexAmendment updated successfully.";
                    break;

                case -2:
                    responses.Status      = Utility.ERROR_STATUS_RESPONSE;
                    responses.Description = "MasterDirectionIndexAmendment already exists.";
                    break;

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

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

                Utility.WriteLog("UpdateMasterDirectionIndexAmendment", updateMasterDirectionIndexAmendmentRequest, "Error while updating MasterDirectionIndexAmendment. (MasterDirectionIndexAmendmentAdminController)", ex.ToString());
            }
            return(Ok(responses));
        }