示例#1
0
        public ActionResult Delete(Guid id)
        {
            ExpanseTypesRepositery expTypeRepo = new ExpanseTypesRepositery();
            List <ExpanseTypes>    expTypes    = expTypeRepo.getByTvaId(id).ToList();

            foreach (var expType in expTypes)
            {
                expTypeRepo.delete(expType);
            }
            expTypeRepo.Save();
            TvasRepositery tvaRepo = new TvasRepositery();
            Tvas           tva     = tvaRepo.tvasById(id);

            tvaRepo.delete(tva);
            tvaRepo.Save();
            return(RedirectToAction("AllTvas"));
        }
        public ActionResult Delete(Guid id)
        {
            ExpanseTypesRepositery expTypeRepo = new ExpanseTypesRepositery();
            ExpanseRepositery      expRep      = new ExpanseRepositery();
            List <Expanses>        expList     = expRep.GetExpansesByIdExpanseTypes(id).ToList();

            foreach (var expanse in expList)
            {
                expRep.Delete(expanse);
            }
            expRep.Save();
            ExpanseTypes expanseType = expTypeRepo.getById(id);

            expTypeRepo.delete(expanseType);
            expTypeRepo.Save();
            return(RedirectToAction("AllExpanseTypes"));
        }