Exemplo n.º 1
0
        private void UpdateAuth(string cardPkId, IList <Device> devices)
        {
            var repo       = new BaseRepo <CardAuth>(dbCtx);
            var existsList = repo.Find(t => t.Card == cardPkId);

            foreach (var e in existsList)
            {
                repo.Delete(e);
            }

            if (devices != null && devices.Count > 0)
            {
                var updateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                foreach (var dev in devices)
                {
                    var entity = new CardAuth()
                    {
                        Card       = cardPkId,
                        Device     = dev.PkId,
                        UpdateTime = updateTime
                    };
                    entity.NewId();
                    repo.Add(entity);
                }
            }
        }
Exemplo n.º 2
0
        public virtual bool Delete(IEnumerable <TEntity> entities)
        {
            using (var cxt = DbContext(DbOperation.Write))
            {
                try
                {
                    cxt.BeginTransaction();
                    var repo      = new BaseRepo <TEntity>(cxt);
                    var isSuccess = repo.Delete(entities);

                    if (isSuccess)
                    {
                        cxt.Commit();
                    }
                    else
                    {
                        cxt.Rollback();
                    }

                    return(isSuccess);
                }
                catch (Exception ex)
                {
                    cxt.Rollback();
                    return(false);
                }
            }
        }
        public ActionResult Delete(int id)
        {
            T entity = repo.GetById(id);

            repo.Delete(entity);
            DeleteFilter(id);
            return(Redirect(entity));
        }
Exemplo n.º 4
0
 private void PatientDelete()
 {
     _dialogService.ShowDialog("ClinicNotificationView", r =>
     {
         if (r.Result == ButtonResult.Yes)
         {
             patRepo.Delete(SelectedPatient);
             Patients = new ObservableCollection <Patient>(patRepo.GetAll());
         }
     });
 }
Exemplo n.º 5
0
 private void DiagnosisDelete()
 {
     _dialogService.ShowDialog("ClinicNotificationView", r =>
     {
         if (r.Result == ButtonResult.Yes)
         {
             diagRepo.Delete(SelectedDiagnosis);
             Diagnoses = new ObservableCollection <Diagnosis>(diagRepo.GetAll());
         }
     });
 }
Exemplo n.º 6
0
        public ActionResult Delete([Bind(Include = "Id, Timestamp")] Folder folder)
        {
            if (ModelState.IsValid)
            {
                _repo.Delete(folder);
                // _repo.Delete(_repo.GetOne(1));
                return(RedirectToAction("Index"));
            }

            return(View(folder));
        }
Exemplo n.º 7
0
        public ActionResult Delete(D model)
        {
            BaseRepo <T> repo        = SetRepo();
            T            deletedItem = repo.GetById(model.Id);

            repo.Delete(deletedItem);

            ExtraDelete(deletedItem);

            return(RedirectToAction("Index"));
        }
Exemplo n.º 8
0
 public ActionResult BookDel(int id)
 {
     if (id == null)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
     }
     else
     {
         repo.Delete(id);
         return(new HttpStatusCodeResult(HttpStatusCode.OK));
     }
 }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            BaseRepo <Car> cars = new BaseRepo <Car>();

            WriteLine("******Cars******");
            foreach (var car in cars.GetAll())
            {
                WriteLine(car);
            }

            cars.Add(new Car {
                Make = "make1", Color = "color1", PetName = "name1"
            });
            WriteLine("***Add car***");

            cars.AddRange(new List <Car>()
            {
                new Car {
                    Make = "make2", Color = "color2", PetName = "name2"
                },
                new Car {
                    Make = "make3", Color = "color3", PetName = "name3"
                }
            });
            WriteLine("***Add cars***");

            WriteLine("******Cars******");
            foreach (var car in cars.GetAll())
            {
                WriteLine(car);
            }

            cars.GetOne(1).Color = "blue";
            WriteLine("***Update car***");

            WriteLine("******Cars******");
            foreach (var car in cars.GetAll())
            {
                WriteLine(car);
            }

            cars.Delete(cars.GetOne(5));
            WriteLine("***Delete car***");

            WriteLine("******Cars******");
            foreach (var car in cars.GetAll())
            {
                WriteLine(car);
            }

            ReadKey();
        }
 public void Delete(T entity)
 {
     ProcessReceivers(entity, EventType.EntityDeleting);
     BaseRepo.Delete(entity);
     ProcessReceivers(entity, EventType.EntityDeleted);
 }
Exemplo n.º 11
0
 public void Delete(TType entity)
 {
     repo.Delete(entity);
 }
Exemplo n.º 12
0
 public int Delete(int id)
 {
     return(_menusRepo.Delete(id));
 }
Exemplo n.º 13
0
 public ActionResult Delete([Bind(Include = "Id, Timestamp")] File file)
 {
     _repo.Delete(file);
     return(RedirectToAction("Index", "Folder"));
 }
Exemplo n.º 14
0
 public int Delete(int id, IDbTransaction transaction)
 {
     return(_staffsRepo.Delete(id));
 }