public ActionResult EditIOS(Entity.AppVersion entity) { var isAdd = entity.ID == 0 ? true : false; LoadPlatform(); BLL.BaseBLL <Entity.AppVersion> bll = new BLL.BaseBLL <Entity.AppVersion>(); entity.Platforms = Entity.APPVersionPlatforms.IOS; entity.LogoImg = "null"; entity.MD5 = "null"; ModelState.Remove("LogoImg"); ModelState.Remove("MD5"); //数据验证 if (isAdd) { //判断版本是否存在 if (bll.Exists(p => p.Platforms == Entity.APPVersionPlatforms.IOS && p.APPType == entity.APPType && p.Version == entity.Version)) { ModelState.AddModelError("Version", "该版本存在"); } } else { if (bll.Exists(p => p.ID == entity.ID)) { return(PromptView("/admin/AppVersion", "404", "Not Found", "信息不存在或已被删除", 5)); } } if (ModelState.IsValid) { //添加 if (entity.ID == 0) { var new_ver = bll.GetModel(p => p.Platforms == Entity.APPVersionPlatforms.IOS && p.APPType == entity.APPType, "VersionCode desc"); entity.VersionCode = new_ver == null ? 1 : new_ver.VersionCode + 1; entity.AddTime = DateTime.Now; bll.Add(entity); } else //修改 { //var old_entity = db.AppVersions.Find(entity.ID); //db.Entry(old_entity).CurrentValues.SetValues(entity); bll.Modify(entity); } return(PromptView("/admin/AppVersion", "OK", "Success", "操作成功", 5)); } else { return(View(entity)); } }
public ActionResult EditAndroid(Entity.AppVersion entity) { var isAdd = entity.ID == 0 ? true : false; BLL.BaseBLL <Entity.AppVersion> bll = new BLL.BaseBLL <Entity.AppVersion>(); entity.APPType = Entity.APPVersionType.Standard; entity.Platforms = Entity.APPVersionPlatforms.Android; //数据验证 if (isAdd) { //判断版本是否存在 if (bll.Exists(p => p.Platforms == Entity.APPVersionPlatforms.Android && p.APPType == Entity.APPVersionType.Standard && p.Version == entity.Version)) { ModelState.AddModelError("Content", "该版本存在"); } } else { if (!bll.Exists(p => p.ID == entity.ID)) { return(PromptView("/admin/AppVersion", "404", "Not Found", "信息不存在或已被删除", 5)); } } if (ModelState.IsValid) { //添加 if (entity.ID == 0) { entity.AddTime = DateTime.Now; bll.Add(entity); } else //修改 { bll.Modify(entity); } return(PromptView("/admin/AppVersion", "OK", "Success", "操作成功", 5)); } else { return(View(entity)); } }
public ActionResult EditAndroid(int?id) { int num = TypeHelper.ObjectToInt(id, 0); Entity.AppVersion entity = new Entity.AppVersion(); if (num != 0) { BLL.BaseBLL <Entity.AppVersion> bll = new BLL.BaseBLL <Entity.AppVersion>(); entity = bll.GetModel(p => p.ID == num, null); if (entity == null) { return(PromptView("/admin/AppVersion", "404", "Not Found", "信息不存在或已被删除", 5)); } if (entity.Platforms != Entity.APPVersionPlatforms.Android) { return(PromptView("/admin/AppVersion", "400", "数据非法", "此信息非安卓版本", 5)); } } return(View(entity)); }