Ejemplo n.º 1
0
        public QrcodeViewModel Add(QrcodeViewModel model)
        {
            model.Id = Guid.NewGuid().ToString();
            Qrcode entity = new Qrcode();

            uow.Set <Qrcode>().Add(entity);
            entity.Id          = model.Id;
            entity.Content     = model.Content;
            entity.Path        = model.Path;
            entity.ExpireAt    = model.ExpireAt;
            entity.Purpose     = model.Purpose;
            entity.ScanedCount = model.ScanedCount;
            entity.Creator     = model.Creator;
            uow.Commit();
            return(new QrcodeViewModel(entity));
        }
Ejemplo n.º 2
0
        public QrcodeViewModel Update(QrcodeViewModel model)
        {
            var entity = uow.Set <Qrcode>().Find(model.Id);

            if (entity == null)
            {
                return(null);
            }

            entity.Content     = model.Content;
            entity.Path        = model.Path;
            entity.ExpireAt    = model.ExpireAt;
            entity.Purpose     = model.Purpose;
            entity.ScanedCount = model.ScanedCount;
            entity.Creator     = model.Creator;
            uow.Commit();
            return(new QrcodeViewModel(entity));
        }