public ActionResult Create(FormCollection collection) { var model = new Measure(); this.TryUpdateModel<Measure>(model); this.ProjectService.SaveMeasure(model); return this.RefreshParent(); }
public ActionResult Create(FormCollection collection) { var model = new ProjectBasedata(); model.PSDate = DateTime.Now.ToString("yyyy/MM/dd"); model.PEdate = DateTime.Now.ToString("yyyy/MM/dd"); this.TryUpdateModel<ProjectBasedata>(model); this.ProjectService.SaveProjectBasedata(model); var labor = new LaborCost(); labor.ProjectID = model.ID; labor.ProjectName = model.PName; this.TryUpdateModel<LaborCost>(labor); this.ProjectService.SaveLaborCost(labor); var material = new MaterialCost(); material.ProjectID = model.ID; material.ProjectName = model.PName; this.TryUpdateModel<MaterialCost>(material); this.ProjectService.SaveMaterialCost(material); var machine = new MachineryCost(); machine.ProjectID = model.ID; machine.ProjectName = model.PName; this.TryUpdateModel<MachineryCost>(machine); this.ProjectService.SaveMachineryCost(machine); var measure = new Measure(); measure.ProjectID = model.ID; measure.ProjectName = model.PName; this.TryUpdateModel<Measure>(measure); this.ProjectService.SaveMeasure(measure); var overhead = new Overhead(); overhead.ProjectID = model.ID; overhead.ProjectName = model.PName; this.TryUpdateModel<Overhead>(overhead); this.ProjectService.SaveOverhead(overhead); var budgetinfo = new BudgetInfo(); budgetinfo.ProjectID = model.ID; budgetinfo.ProjectName = model.PName; this.TryUpdateModel<BudgetInfo>(budgetinfo); this.ProjectService.SaveBudget(budgetinfo); return this.RefreshParent(); }
// // GET: /Project/Labor/Create public ActionResult Create() { var model = new Measure(); return View("Edit", model); }
public void SaveMeasure(Measure measure) { using (var dbContext = new ProjectDbContext()) { if (measure.ID >0) { var budgets = dbContext.Budgets.ToList(); if (measure.MeasureTotal > 0) { foreach (var budget in budgets) { if (budget.ProjectID == measure.ProjectID) { budget.MeasureID = measure.ID; dbContext.Update<BudgetInfo>(budget); } } } dbContext.Update<Measure>(measure); } else { dbContext.Insert<Measure>(measure); } } }