Exemplo n.º 1
0
        public CRUD_Image_Response CreateImage(CRUD_Image_Request request)
        {
            var response = new CRUD_Image_Response();

            try
            {
                var image = Mapper.Map <CRUD_Image_Request, Images>(request);
                this._IImagesRepository.Add(image);
                int saveStatus = this._IUnitOfWork.Commit();
                if (saveStatus > 0)
                {
                    response.StatusCode = (int)RESULT_STATUS_CODE.SUCCESS;
                }
                else
                {
                    response.StatusCode = (int)RESULT_STATUS_CODE.DATABASE_ERROR;
                }
            }
            catch (Exception ex)
            {
                response.StatusCode    = (int)RESULT_STATUS_CODE.SYSTEM_ERROR;
                response.StatusMessage = ex.ToString();
            }
            return(response);
        }
Exemplo n.º 2
0
        public CRUD_Image_Response DeleteImage(long Id)
        {
            var response = new CRUD_Image_Response();

            try
            {
                this._IImagesRepository.Delete(Id);
                int saveStatus = this._IUnitOfWork.Commit();
                if (saveStatus > 0)
                {
                    response.StatusCode = (int)RESULT_STATUS_CODE.SUCCESS;
                }
                else
                {
                    response.StatusCode = (int)RESULT_STATUS_CODE.DATABASE_ERROR;
                }
            }
            catch (Exception ex)
            {
                response.StatusCode    = (int)RESULT_STATUS_CODE.SYSTEM_ERROR;
                response.StatusMessage = ex.ToString();
            }
            return(response);
        }