示例#1
0
 public async Task <ValueEntity> Update(Guid id, ValueEntity item)
 {
     using (var context = new FormsEntities())
     {
         var entity = context.Values.Find(id);
         entity.ModifiedDateTime = DateTime.Now;
         context.SaveChanges();
         return(entity);
     }
 }
示例#2
0
        public static ValueViewModel ToViewModel(this ValueEntity item)
        {
            var model = new ValueViewModel()
            {
                Id = item.Id,
                CreatedDateTime  = item.CreatedDateTime,
                FormId           = item.FormId,
                IsSent           = item.IsSent,
                Latitude         = item.Latitude,
                Longitude        = item.Longitude,
                ModifiedDateTime = item.ModifiedDateTime,
                SyncDateTime     = item.SyncDateTime,
                UserId           = item.UserId
            };

            return(model);
        }
示例#3
0
 public async Task <ValueEntity> Create(ValueEntity item)
 {
     using (var context = new FormsEntities())
     {
         if (item.Id == null || item.Id == Guid.Empty)
         {
             item.Id = Guid.NewGuid();
         }
         else
         {
             item.Id = new Guid(item.Id.ToString());
         }
         item.CreatedDateTime = DateTime.Now;
         context.Values.Add(item);
         context.SaveChanges();
         return(item);
     }
 }