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());
     }
 }
示例#3
0
        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"));
        }
示例#4
0
        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"));
        }
示例#5
0
 public Mobile(MobileBrand brand, MobileType type)
 {
     Brand = brand;
     Type  = type;
 }
示例#6
0
 public Mobile(MobileBrand brand, MobileType type)
 {
     Brand = brand;
     Type = type;
 }
示例#7
0
 public bool Delete(MobileBrand entity)
 {
     _dbContext.Remove(entity);
     return(Save());
 }
示例#8
0
 public bool Update(MobileBrand entity)
 {
     _dbContext.Update(entity);
     return(Save());
 }
示例#9
0
 public bool Create(MobileBrand entity)
 {
     _dbContext.Add(entity);
     return(Save());
 }