Exemple #1
0
 public async Task <int> DeletePropertyDocumentAsync(PropertyCheckListDocumentsModel documents)
 {
     using (var dataService = DataServiceFactory.CreateDataService())
     {
         var doc = new PropertyCheckListDocuments();
         UpdateDocumentFromModel(doc, documents);
         return(await dataService.DeletePropertyCheckListDocumentAsync(doc));
     }
 }
Exemple #2
0
 private void UpdateDocumentFromModel(PropertyCheckListDocuments target, PropertyCheckListDocumentsModel source)
 {
     target.PropertyCheckListBlobId = source.PropertyCheckListBlobId;
     target.CheckListPropertyId     = source.CheckListPropertyId;
     target.PropertyGuid            = source.guid;
     target.FileBlob             = source.ImageBytes;
     target.FileName             = source.FileName;
     target.FileType             = source.ContentType;
     target.FileCategoryId       = source.FileCategoryId;
     target.UploadTime           = DateTime.Now;
     target.DueDate              = source.DueDate.UtcDateTime;
     target.ActualCompletionDate = source.ActualCompletionDate.UtcDateTime;
     target.Remarks              = source.Remarks;
 }
Exemple #3
0
 public async Task <int> SaveDocuments(ICollection <PropertyCheckListDocumentsModel> docs, Guid propertyGuid)
 {
     if (docs != null && docs.Count > 0)
     {
         using (var dataService = DataServiceFactory.CreateDataService())
         {
             List <PropertyCheckListDocuments> docList = new List <PropertyCheckListDocuments>();
             foreach (var obj in docs)
             {
                 var doc = new PropertyCheckListDocuments();
                 UpdateDocumentFromModel(doc, obj);
                 doc.PropertyGuid = propertyGuid;
                 docList.Add(doc);
             }
             return(await dataService.UploadPropertyCheckListDocumentsAsync(docList));
         }
     }
     return(0);
 }
Exemple #4
0
        private void UpdateCheckListFromModel(CheckListOfProperty target, CheckListOfPropertyModel source)
        {
            target.CheckListPropertyId = source.CheckListPropertyId;
            target.CheckListId         = source.CheckListId;
            target.PropertyCheckListId = source.PropertyCheckListId;
            target.Mandatory           = source.Mandatory;
            target.Delete = source.Delete;

            if (source.Documents == null)
            {
                return;
            }

            List <PropertyCheckListDocuments> docList = new List <PropertyCheckListDocuments>();

            foreach (var obj in source.Documents)
            {
                var doc = new PropertyCheckListDocuments();
                UpdateDocumentFromModel(doc, obj);
                docList.Add(doc);
            }
            target.Documents = docList;
        }
 public async Task <int> DeletePropertyCheckListDocumentAsync(PropertyCheckListDocuments documents)
 {
     _dataSource.PropertyCheckListDocuments.Remove(documents);
     return(await _dataSource.SaveChangesAsync());
 }