public RequirementTypeContext(RequirementType rType) { this.TenantId = rType.TenantId; this.TypeId = rType.TypeId; this.Name = rType.Name; this.MatchedProjects = DbUtils.GetProjectsByRequirementType(rType.TypeId); }
public ActionResult Create(string typeName) { if (!Auth.IsLoggedIn()) { return RedirectToAction("Login", "Home"); } if (!Auth.IsUsingCustomTypes() || !Auth.GetCurrentUser().IsAdmin) { return RedirectToAction("Index"); } if (string.IsNullOrWhiteSpace(typeName)) { return View(); } RequirementType newType = new RequirementType(); newType.Name = typeName; DbUtils.InsertRequirementType(newType); return RedirectToAction("Index"); }
public ActionResult Edit(RequirementType rType) { if (!Auth.IsLoggedIn()) { return RedirectToAction("Login", "Home"); } if (!Auth.IsUsingCustomTypes() || !Auth.GetCurrentUser().IsAdmin) { return RedirectToAction("Index"); } if (string.IsNullOrWhiteSpace(rType.Name)) { return RedirectToAction("Edit", new { id = rType.TypeId }); } DbUtils.UpdateRequirementType(rType); return RedirectToAction("Index"); }
public static bool UpdateRequirementType(RequirementType rType) { bool success = false; using (var db = new DataClassesDataContext()) { var target = db.RequirementTypes.Where(t => t.TenantId == Auth.GetTenantId() && t.TypeId == rType.TypeId).FirstOrDefault(); if (target != null) { target.Name = rType.Name; db.SubmitChanges(); success = true; } } return success; }
public static bool InsertRequirementType(RequirementType rType) { bool success = false; rType.TenantId = Auth.GetTenantId(); using (var db = new DataClassesDataContext()) { db.RequirementTypes.InsertOnSubmit(rType); db.SubmitChanges(); success = true; } return success; }
partial void DeleteRequirementType(RequirementType instance);
partial void UpdateRequirementType(RequirementType instance);
partial void InsertRequirementType(RequirementType instance);
private void detach_RequirementTypes(RequirementType entity) { this.SendPropertyChanging(); entity.Tenant = null; }