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