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 (NullReferenceException e)
            {
                response.Text   = "Unfortunately something went wrong. Are you sure the entity you are trying to delete exists ?" + e.GetType();
                response.Result = false;
            }
            return(response);
        }
示例#2
0
        /// <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 . \n";
                response.Result = true;

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

                return(response);
            }
        }
示例#3
0
        public ApiResponse DeleteById(long id)
        {
            AccountProcessor = new AccountProcessor();
            Response         = new ApiResponse();

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

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

                return(Response);
            }
        }