public ActionResult Add(RM_BiddingAgency entity) { if (entity.Id == Guid.Empty) { entity.CreateUser = CurrentUser.Id; } else { entity.UpdateUser = CurrentUser.Id; } return(Json(new JsonMessage(service.AddBiddingAgency(entity)))); }
public bool AddBiddingAgency(RM_BiddingAgency entity) { using (DataProvider dp = new DataProvider()) { if (entity.Id == Guid.Empty) { entity.Id = Guid.NewGuid(); entity.CreateTime = DateTime.Now; dp.RM_BiddingAgency.Add(entity); } else { var model = dp.RM_BiddingAgency.FirstOrDefault(m => m.Id == entity.Id); model.TenderType = entity.TenderType; model.TenderWay = entity.TenderWay; model.AgentMan = entity.AgentMan; model.Salesman = entity.Salesman; model.ProjectName = entity.ProjectName; model.EntrustingParty = entity.EntrustingParty; model.EPMan = entity.EPMan; model.EPTel = entity.EPTel; model.OpenTime = entity.OpenTime; model.SignUpCount = entity.SignUpCount; model.WinningUnit = entity.WinningUnit; model.AuthorizedMan = entity.AuthorizedMan; model.AuthorizedTel = entity.AuthorizedTel; model.WinningAmount = entity.WinningAmount; model.WinningM = entity.WinningM; model.WorkTime = entity.WorkTime; model.WorkDesc = entity.WorkDesc; model.EnclosureName = entity.EnclosureName; model.EnclusurePath = entity.EnclusurePath; model.RegFee = entity.RegFee; model.RegFeeWay = entity.RegFeeWay; model.AgencyFee = entity.AgencyFee; model.AgencyUnit = entity.AgencyUnit; model.AppraisalFee = entity.AppraisalFee; model.ChargeStatus = entity.ChargeStatus; model.InvoiceStatus = entity.InvoiceStatus; model.UpdateTime = DateTime.Now; } try { dp.SaveChanges(); return(true); } catch { return(false); } } }