Ejemplo n.º 1
0
        public HttpResponseMessage PostUpload(string landlordReference, string submittedPropertyReference, Upload upload)
        {
            Check.If(landlordReference).IsNotNullOrEmpty();
            Check.If(submittedPropertyReference).IsNotNullOrEmpty();
            Check.If(upload).IsNotNull();

            var result = _uploadService.CreateUpload(landlordReference, submittedPropertyReference,
                Mapper.Map<Core.Objects.Upload>(upload));

            if (result == null)
            {
                return new HttpResponseMessage {StatusCode = HttpStatusCode.InternalServerError};
            }

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

            response.Headers.Location =
                new Uri(Url.Link("GetSubmittedPropertyUpload",
                    new {landlordReference, submittedPropertyReference, uploadReference = result}));

            return response;
        }
Ejemplo n.º 2
0
        public HttpResponseMessage PutUpload(string landlordReference, string submittedPropertyReference, string uploadReference, Upload upload)
        {
            Check.If(landlordReference).IsNotNullOrEmpty();
            Check.If(submittedPropertyReference).IsNotNullOrEmpty();
            Check.If(uploadReference).IsNotNullOrEmpty();
            Check.If(upload).IsNotNull();

            var result = _uploadService.UpdateUpload(landlordReference, submittedPropertyReference, uploadReference, Mapper.Map<Core.Objects.Upload>(upload));

            return result
                ? new HttpResponseMessage { StatusCode = HttpStatusCode.OK }
                : new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError };
        }