Beispiel #1
0
        public ApiResponse Create(List <MakeParam> param)
        {
            MakeProcessor = new MakeProcessor();
            Response      = new ApiResponse();

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

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

                return(Response);
            }
        }
Beispiel #2
0
        public ApiResponse DeleteById(long id)
        {
            MakeProcessor = new MakeProcessor();
            Response      = new ApiResponse();

            try
            {
                MakeProcessor.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);
            }
        }
Beispiel #3
0
        public ApiResponse Delete(List <long> idList)
        {
            MakeProcessor = new MakeProcessor();
            Response      = new ApiResponse();

            try
            {
                MakeProcessor.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);
            }
        }
Beispiel #4
0
        public ApiResponse Update(long id, MakeParam param)
        {
            MakeProcessor = new MakeProcessor();
            Response      = new ApiResponse();

            try
            {
                MakeProcessor.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);
            }
        }
Beispiel #5
0
        public ApiResponse ListAll()
        {
            MakeProcessor = new MakeProcessor();
            Response      = new ApiResponse();

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

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

                return(Response);
            }
        }
Beispiel #6
0
        public ApiResponse FindByPK(long id)
        {
            MakeProcessor = new MakeProcessor();
            Response      = new ApiResponse();

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

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

                return(Response);
            }
        }
Beispiel #7
0
        public ApiResponse Update(List <MakeParam> param)
        {
            MakeProcessor = new MakeProcessor();
            Response      = new ApiResponse();

            try
            {
                MakeProcessor.Update(param);

                Response.text   = "Entities were successfully updated.";
                Response.result = true;

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

                return(Response);
            }
        }