예제 #1
0
        public ActionResult Edit(ProductTypeViewModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(model));
                }
                var productType = _mapper.Map <ProductType>(model);
                productType.UpdatedAt = DateTime.Now;
                var isSuccess = _repo.Update(productType);

                if (!isSuccess)
                {
                    ModelState.AddModelError("", "Something Went Wrong");
                    return(View(model));
                }

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                ModelState.AddModelError("", "Something Went Wrong");
                return(View());
            }
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(MesWeb.Model.ProductType model)
 {
     return(dal.Update(model));
 }
예제 #3
0
 public static void Update(ProductTypeInfo entity)
 {
     dal.Update(entity);
     CacheHelper.Remove(cacheKey);
 }