public ActionResult update(Guid id) { ExpanseTypesRepositery expTypeRep = new ExpanseTypesRepositery(); ExpanseTypes expTypes = expTypeRep.getById(id); ExpanseTypesModel expTypeModel = new ExpanseTypesModel(); if (!ModelState.IsValid) { TvasRepositery tvaRepo = new TvasRepositery(); var tvaLis = tvaRepo.allTvas().ToList(); expTypeModel.tvaList = tvaLis; expTypeModel.ExpenseType_ID = expTypes.ExpenseType_ID; expTypeModel.Name = expTypes.Name; expTypeModel.Ceiling = expTypes.Ceiling; expTypeModel.Fixed = expTypes.Fixed; expTypeModel.OnlyManagers = expTypes.OnlyManagers; return(View("EditExpansesTypes", expTypeModel)); } String name = Convert.ToString(Request.Form["Name"]); double ceiling = Convert.ToDouble(Request.Form["Ceiling"]); Boolean fixe = Convert.ToBoolean(Request.Form["Fixed"]); Boolean OnlyManagers = Convert.ToBoolean(Request.Form["OnlyManagers"]); expTypeRep.updateExpanseType(expTypes, name, ceiling, fixe, OnlyManagers); return(RedirectToAction("AllExpanseTypes")); }
public ActionResult edit(Guid id) { ExpanseTypesRepositery expTypeRep = new ExpanseTypesRepositery(); ExpanseTypes expTypes = expTypeRep.getById(id); ExpanseTypesModel expTypeModel = new ExpanseTypesModel(); expTypeModel.ExpenseType_ID = expTypes.ExpenseType_ID; expTypeModel.Name = expTypes.Name; expTypeModel.Ceiling = expTypes.Ceiling; expTypeModel.Fixed = expTypes.Fixed; expTypeModel.OnlyManagers = expTypes.OnlyManagers; return(View("EditExpansesTypes", expTypeModel)); }
public String cellingTvaById(Guid expanseTypeID) { double celling = 0; String cellingTva = null; ExpanseTypesRepositery expTypeRep = new ExpanseTypesRepositery(); var expAnseType = expTypeRep.getById(expanseTypeID); double tva = (double)expAnseType.Tvas.Value; if (expAnseType.Fixed == true) { celling = (double)expAnseType.Ceiling; } cellingTva = Convert.ToString(celling) + "-" + Convert.ToString(tva); return(cellingTva); }
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")); }