public ActionResult DeleteBid(int id) { string errMsg = string.Empty; #region 验证参数 if (id == 0) { errMsg = "竞价标的Id不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } #endregion IData_BidManageService data_BidManageService = BLLContainer.Resolve <IData_BidManageService>(); if (data_BidManageService.GetCount(p => p.ID == id) == 0) { errMsg = "该竞价标的不存在"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } var data_BidManage = data_BidManageService.GetModels(p => p.ID == id).FirstOrDefault(); if (!data_BidManageService.Delete(data_BidManage)) { return(RedirectToAction("Index", "BidManage", new { errMsg = "更新数据库失败" })); } return(RedirectToAction("Index", "BidManage", new { errMsg = "删除成功" })); }