public bool Update(DetailCategory detailCategory) { bool isUpdated = repository.Update(detailCategory); return(isUpdated); ; }
public bool Add(DetailCategory detailCategory) { AssetDBContext db = new AssetDBContext(); db.DetailCategories.Add(detailCategory); int rowAffected = db.SaveChanges(); return(rowAffected > 0); }
public bool Update(DetailCategory detailCategory) { AssetDBContext db = new AssetDBContext(); db.DetailCategories.Attach(detailCategory); db.Entry(detailCategory).State = EntityState.Modified; int rowAffacted = db.SaveChanges(); return(rowAffacted > 0); }
public ActionResult Edit([Bind(Include = "DetailCategoryID,SubCategoryID,DetailCategoryName,DetailCategoryCode,DetailCategoryDescription")] DetailCategory detailcategory) { if (ModelState.IsValid) { _detailCategoryManager.Update(detailcategory); return(RedirectToAction("Index")); } var subCategories = _subCategoryManager.GetAll(); ViewBag.SubCategoryID = new SelectList(subCategories, "SubCategoryID", "SubCategoryName"); return(View(detailcategory)); }
public bool Add(DetailCategory detailCategory) { if (detailCategory.SubCategory == null) { return(false); } if (detailCategory.Code.Length != 2) { return(false); } return(repository.Add(detailCategory)); }
// GET: /DetailCategory/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DetailCategory detailcategory = _detailCategoryManager.GetById((int)id); if (detailcategory == null) { return(HttpNotFound()); } return(View(detailcategory)); }
public static void AddResearchProject(Vector2 location, string defName) { float x = (location.x + (NodeSize.x + NodeMargins.x)) / (NodeSize.x + NodeMargins.x); float y = (location.y + (NodeSize.y + NodeMargins.y)) / (NodeSize.y + NodeMargins.y); ResearchProjectDef newDef = new ResearchProjectDef(); newDef.defName = defName; newDef.label = defName; newDef.description = defName; newDef.baseCost = 600; newDef.techLevel = TechLevel.Industrial; newDef.researchViewX = Rand.Range(0, 500) / 100f; newDef.researchViewY = Rand.Range(0, 500) / 100f; newDef.tab = ResearchTabDefOf.Main; ProfileManager.AddCommand(Enqueue().New(typeof(ResearchProjectDef))); ProfileManager.AddCommand(Enqueue().Dequeue().Set(new { newDef.defName }).Find(defName)); ProfileManager.AddCommand(Enqueue().Dequeue().Set(new { newDef.label }).Find(defName)); ProfileManager.AddCommand(Enqueue().Dequeue().Set(new { newDef.description }).Find(defName)); ProfileManager.AddCommand(Enqueue().Dequeue().Set(new { newDef.baseCost }).Find(newDef.baseCost)); ProfileManager.AddCommand(Enqueue().Dequeue().Set(new { newDef.techLevel }).Find(TechLevel.Industrial)); ProfileManager.AddCommand(Enqueue().Dequeue().Set(new { newDef.researchViewX }).Find(newDef.researchViewX)); ProfileManager.AddCommand(Enqueue().Dequeue().Set(new { newDef.tab }).Find(newDef.tab)); ProfileManager.AddCommand(Add().Dequeue().Set(new { newDef.researchViewY }).Find(newDef.researchViewY)); DefDatabase <ResearchProjectDef> .Add(newDef); //we're refreshing now smilers //wait no we're not KEKWait ResearchNode node = new ResearchNode(newDef); node.X = Mathf.RoundToInt(x); node.Y = Mathf.RoundToInt(y); DRimEditor.Research.Tree._nodes.Add(node); //ResearchWindow.Refresh(); //ResearchNode sel = Research.Tree.Nodes.Find(n => n is ResearchNode rn && rn.Research == newDef) as ResearchNode; ResearchSelectPanel.Select(node); ResearchSelectPanel.newName = newDef.label; //DefExplorerWindow.Recache(); if (DefExplorerWindow.initialized) { //DetailCategory cat = DefDatabase<DetailCategory>.AllDefsListForReading.Find(c => c.defType == typeof(ResearchProjectDef)); DetailCategory cat = DefExplorerWindow.detailCategories[typeof(ResearchProjectDef)]; DefExplorerWindow.instance.AddNewDefToCat(newDef, cat); } }
// GET: /DetailCategory/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DetailCategory detailcategory = _detailCategoryManager.GetById((int)id); if (detailcategory == null) { return(HttpNotFound()); } var subCategories = _subCategoryManager.GetAll(); ViewBag.SubCategoryID = new SelectList(subCategories, "SubCategoryID", "SubCategoryName"); return(View(detailcategory)); }
public DetailCategory GetCategoryDetail(string categoryName) //获取分类详情 { DetailCategory category = new DetailCategory(); category.Texts = new List <TextsBelone>(); category.Category = GetManageCategories().Find(c => c.CategoryName == categoryName); var texts = repository.GetTextsAll().Where(c => c.CategoryName == categoryName); foreach (var item in texts) { var textsBelong = new TextsBelone { TextID = item.TextID, TextTitle = item.TextTitle, Hot = item.Hot, ChangeTime = item.TextChangeDate.ToString() }; category.Texts.Add(textsBelong); } return(category); }
public bool Update(DetailCategory entity) { return(_detailCategoryRepository.Update(entity)); }
public bool Add(DetailCategory entity) { return(_detailCategoryRepository.Add(entity)); }