예제 #1
0
        public HttpResponseMessage DeleteFile(Guid id)
        {
            Domain.Binary file = _fileService.Find(x => x.Guid == id);
            if (file != null)
            {
                _fileService.Delete(file);
                _unitOfWork.SaveChanges();

                return(Request.CreateResponse(HttpStatusCode.OK));
            }

            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.BadRequest);

            return(response);
        }
예제 #2
0
        public HttpResponseMessage UpdateFile(FileViewModel model)
        {
            Domain.Binary file = _fileService.Find(x => x.Guid == model.Guid);
            if (file != null)
            {
                file.Desctiption = model.Desctiption;
                //  _fileService.Update(file);
                _unitOfWork.SaveChanges();

                return(new HttpResponseMessage {
                    StatusCode = HttpStatusCode.OK
                });
            }

            var response = new HttpResponseMessage {
                StatusCode = HttpStatusCode.NotAcceptable
            };

            return(response);
        }