/// <summary> /// 注册 /// </summary> /// <param name="info"></param> /// <returns></returns> public ActionResult AddTypeF(ProductTypeF info) { var exists = _context.ProductTypeF.Any(r => r.TypeName == info.TypeName); if (exists) { return(Content(info.TypeName + "已存在")); } _context.ProductTypeF.Add(info); _context.SaveChanges(); return(Content("OK")); }
/// <summary> /// 修改用户信息 /// </summary> /// <param name="info"></param> /// <returns></returns> public ActionResult UpdateTypeF(ProductTypeF info) { var find = _context.ProductTypeF.FirstOrDefault(r => r.TypeId == info.TypeId); if (find == null) { return(Content("信息不存在。")); } var exists = _context.ProductTypeF.Where(r => r.TypeId != find.TypeId).Any(r => r.TypeName == info.TypeName); if (exists) { return(Content(info.TypeName + "已存在")); } find.TypeName = info.TypeName; find.Note = info.Note; _context.SaveChanges(); return(Content("OK")); }