Esempio n. 1
0
        public Response DeleteByID(long id)
        {
            Response response = new Response();

            try
            {
                Processor.Delete(id);
                response.Text   = $"Entity with id {id} was successfully removed from the system.";
                response.Result = true;
            }
            catch
            {
                response.Text   = "Unfortunately something went wrong. Are you sure the entity you are trying to delete exists ?";
                response.Result = false;
            }
            return(response);
        }
        /// <summary>
        /// Function to delete entities .
        /// </summary>
        /// <param name="idList">entities id</param>
        /// <returns>response</returns>
        public ApiResponse Delete(List <long> idList)
        {
            ApiResponse response = new ApiResponse();

            try
            {
                Processor.Delete(idList);
                response.Text   = "The entity was successfully removed .";
                response.Result = true;

                return(response);
            }
            catch (Exception ex)
            {
                response.Result = false;
                response.Text   = ex.Message;

                return(response);
            }
        }
        public ApiResponse DeleteById(long id)
        {
            AccountStatusProcessor = new AccountStatusProcessor();
            Response = new ApiResponse();

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

            try
            {
                AccountStatusProcessor.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);
            }
        }