/// <summary> /// 创建商品类型 /// </summary> /// <param name="model"></param> public static void AddType(DTO.ProductType model) { var type = model.Map <ProductTypeInfo>(); _typeService.AddType(type); model.Id = type.Id; }
public ActionResult SaveModel(TypeModel type) { if (0 != type.Id) { _iTypeService.UpdateType(type); } else if (0 == type.Id) { _iTypeService.AddType(type); } return(RedirectToAction("Management")); }
public ActionResult AddOrEditType(TypeMasterVM typeVM) { try { if (ModelState.IsValid) { bool status = false; if (typeVM.TypeId == 0) { status = _TypeSerivce.AddType(typeVM); if (status) { return(Json(new { success = true, message = "Saved Successfully...!" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, message = "Error..!" }, JsonRequestBehavior.AllowGet)); } } else { status = _TypeSerivce.UpdateType(typeVM); if (status) { return(Json(new { success = true, message = "Updated Successfully...!" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, message = "Error..!" }, JsonRequestBehavior.AllowGet)); } } } else { return(PartialView(typeVM)); } } catch (Exception e) { throw e; } }
public ActionResult SaveModel(TypeInfoModel type) { if (0 != type.Id) { _iTypeService.UpdateType(type); } else if (0 == type.Id) { _iTypeService.AddType(type); } // ServiceHelper.Create<IOperationLogService>().AddPlatformOperationLog( //new LogInfo //{ // Date = DateTime.Now, // Description = "修改平台类目,Id=" + type.Id, // IPAddress = Request.UserHostAddress, // PageUrl = "/ProductType/SaveModel", // UserName = CurrentManager.UserName, // ShopId = 0 //}); return(RedirectToAction("Management")); }
public async Task <ActionResult <BaseResponse> > AddType(TypeAddViewModel req) { var GroupId = User.Claims.FirstOrDefault(a => a.Type == "GroupId").Value; var Account = User.Claims.FirstOrDefault(a => a.Type == "Account").Value; var Code = User.Claims.FirstOrDefault(a => a.Type == "Code").Value; var isAdmin = User.Claims.FirstOrDefault(a => a.Type == "IsAdmin").Value.ToLower() == "true" ? true : false; //验证输入的groupid是否存在 var ex = await _gs.IsExist(a => a.Id == req.GroupId); if (!ex) { return(new BaseResponse { Success = false, Message = "输入的组织编号不存在" }); } //验证用户权限 if (!(isAdmin && (GroupId == req.GroupId || Code == _config["Group"]))) { return(Unauthorized("没有权限")); } var ret = await _ts.AddType(req, Account); return(ret); }