public WorkPermit GetPersistanceEntity()
        {
            var permit = new WorkPermit
            {
                Id          = Guid.NewGuid(),
                Name        = Name,
                Description = Description,
                PeriodFrom  = PeriodFrom,
                PeriodTo    = PeriodTo
            };

            return(permit);
        }
 public Task Save(WorkPermit entity)
 {
     return(Task.Run(
                () =>
     {
         if (_permitsCollection.FindById(entity.Id) != null)
         {
             _permitsCollection.Update(entity.Id, entity);
         }
         else
         {
             _permitsCollection.Insert(entity.Id, entity);
         }
     }
                ));
 }
        public WorkPermitViewModel(WorkPermit workPermit, IEnumerable <Attachment> attachments)
        {
            if (workPermit != null)
            {
                Name        = workPermit.Name;
                Description = workPermit.Description;
                PeriodFrom  = workPermit.PeriodFrom;
                PeriodTo    = workPermit.PeriodTo;
            }

            if (attachments != null)
            {
                Attachments = new ObservableCollection <Attachment>(attachments);
            }
            else
            {
                Attachments = new ObservableCollection <Attachment>();
            }
        }
 public Task Delete(WorkPermit entity)
 {
     return(Task.Run(() => _permitsCollection.Delete(entity.Id)));
 }