Пример #1
0
        public ApiResponse Create(List <ContractStatusParam> param)
        {
            ContractStatusProcessor = new ContractStatusProcessor();
            Response = new ApiResponse();

            try
            {
                Response.text   = JsonConverter.JsonConverter.ObjToJson(ContractStatusProcessor.Create(param));
                Response.result = true;

                return(Response);
            }
            catch
            {
                Response.text   = "Something went wrong :(";
                Response.result = false;

                return(Response);
            }
        }
Пример #2
0
        public ApiResponse DeleteById(long id)
        {
            ContractStatusProcessor = new ContractStatusProcessor();
            Response = new ApiResponse();

            try
            {
                ContractStatusProcessor.Delete(id);
                Response.text   = "Entity was successfully removed from the system.";
                Response.result = true;

                return(Response);
            }
            catch
            {
                Response.text   = "Unfortunately something went wrong :(";
                Response.result = false;

                return(Response);
            }
        }
Пример #3
0
        public ApiResponse Delete(List <long> idList)
        {
            ContractStatusProcessor = new ContractStatusProcessor();
            Response = new ApiResponse();

            try
            {
                ContractStatusProcessor.Delete(idList);
                Response.text   = "Entity was successfully removed from the system.";
                Response.result = true;

                return(Response);
            }
            catch
            {
                Response.text   = "Unfortunately something went wrong. Try again later. :)";
                Response.result = false;

                return(Response);
            }
        }
Пример #4
0
        public ApiResponse Update(long id, ContractStatusParam param)
        {
            ContractStatusProcessor = new ContractStatusProcessor();
            Response = new ApiResponse();

            try
            {
                ContractStatusProcessor.Update(id, param);
                Response.text   = "Entity was successfully updated";
                Response.result = true;

                return(Response);
            }
            catch
            {
                Response.text   = "Unfortunately something went wrong :(";
                Response.result = false;

                return(Response);
            }
        }
Пример #5
0
        public ApiResponse ListAll()
        {
            ContractStatusProcessor = new ContractStatusProcessor();
            Response = new ApiResponse();

            try
            {
                ContractStatusProcessor.Find();
                Response.text   = JsonConverter.JsonConverter.ObjToJson(ContractStatusProcessor.Find());
                Response.result = true;

                return(Response);
            }
            catch
            {
                Response.text   = "Unfortunately something went wrong :(";
                Response.result = false;

                return(Response);
            }
        }
Пример #6
0
        public ApiResponse FindByPK(long id)
        {
            ContractStatusProcessor = new ContractStatusProcessor();
            Response = new ApiResponse();

            try
            {
                ContractStatusProcessor.Find(id);
                Response.text   = "Account with this PK has been found" + Environment.NewLine + JsonConverter.JsonConverter.ObjToJson(ContractStatusProcessor.Find(id));
                Response.result = true;

                return(Response);
            }
            catch
            {
                Response.text   = "An account with this id does not exist";
                Response.result = false;

                return(Response);
            }
        }