Exemplo n.º 1
0
        public ResponseMessage UpdatePhysicalverifyDocment(PhysicalVerificationDocument servicedto)
        {
            ResponseMessage response = new ResponseMessage();

            response.Message = "PhysicalverifyDocment updated succusfully";
            // int projStructId = _siteDispatchRepository.UpsertProjectStructure (servicedto);
            if (servicedto.uploadDocs != null)
            {
                foreach (IFormFile file in servicedto.uploadDocs)
                {
                    Upload_Docs layerDoc = new Upload_Docs();
                    layerDoc.fileName   = file.FileName;
                    layerDoc.filepath   = UploadedFile(file);
                    layerDoc.uploadType = "Docs";
                    layerDoc.fileType   = Path.GetExtension(file.FileName);
                    this._physicalVerificationRepository.StructureDocsUpload(layerDoc, servicedto.sitestructurephysicalverfid);
                    //  _gridRepo.LayerDocsUpload(layerDoc, layerId);
                }
            }
            RemoveStructureDocs(servicedto.remove_docs_filename);
            return(response);
        }
Exemplo n.º 2
0
 public IActionResult UpdatePhysicalverifyDocment([FromForm] PhysicalVerificationDocument request)
 {
     try {
         if (request.uploadDocs != null)
         {
             if (request.uploadDocs.Length > 5)
             {
                 throw new ValueNotFoundException("Document count should not greater than 5");
             }
             foreach (IFormFile file in request.uploadDocs)
             {
                 if (constantVal.AllowedDocFileTypes.Where(x => x.Contains(file.ContentType)).Count() == 0)
                 {
                     throw new ValueNotFoundException(string.Format("File Type {0} is not allowed", file.ContentType));
                 }
             }
             if (request.uploadDocs.Select(x => x.Length).Sum() > 50000000)
             {
                 throw new ValueNotFoundException(" File size exceeded limit");
             }
         }
         var projectStructure = _physicalVerificationService.UpdatePhysicalverifyDocment(request);
         return(Ok(projectStructure));
     } catch (ValueNotFoundException e) {
         Util.LogError(e);
         return(StatusCode(StatusCodes.Status422UnprocessableEntity, new ErrorClass()
         {
             code = StatusCodes.Status422UnprocessableEntity.ToString(), message = e.Message
         }));
     } catch (Exception e) {
         Util.LogError(e);
         return(StatusCode(StatusCodes.Status500InternalServerError, new ErrorClass()
         {
             code = StatusCodes.Status500InternalServerError.ToString(), message = "Something went wrong"
         }));
     }
 }