public ActionResult Create(MobileBrand entity) { try { _brand.Create(entity); return(RedirectToAction(nameof(Index))); } catch (Exception ex) { return(View()); } }
public ActionResult Delete(int id, MobileBrand entity) { try { _brand.Delete(entity); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult BrandEdit(MobileBrand model) { var brand = dbContextService.Single <MobileBrand>(model.Id); brand.Name = model.Name; brand.Value = brand.Value; brand.Status = model.Status; brand.Comment = model.Comment; brand.CreateDateTime = DateTime.Now; dbContextService.Update <MobileBrand>(brand); return(RedirectToAction("BrandList")); }
public ActionResult BrandAdd(MobileBrand model) { var exist = dbContextService.Exists <MobileBrand>(x => x.Value == model.Value); if (exist) { TempData["errorMsg"] = "该品牌已经存在!"; return(View()); } var ret = dbContextService.Add <MobileBrand>(model); return(RedirectToAction("BrandList")); }
public Mobile(MobileBrand brand, MobileType type) { Brand = brand; Type = type; }
public bool Delete(MobileBrand entity) { _dbContext.Remove(entity); return(Save()); }
public bool Update(MobileBrand entity) { _dbContext.Update(entity); return(Save()); }
public bool Create(MobileBrand entity) { _dbContext.Add(entity); return(Save()); }