public APIResult SaveRecheckStatusDtl(RecheckStatusDtl recheckStatusDtl) { try { // 验证所有的题目是否都复审完毕,需要补充 List <AnswerDto> recheckList = recheckService.GetNotRecheckSubject(recheckStatusDtl.ProjectId.ToString(), recheckStatusDtl.ShopId.ToString(), recheckStatusDtl.RecheckTypeId.ToString()); if (recheckList != null && recheckList.Count != 0) { throw new Exception("存在未复审的题目,请先复审完毕"); } // 验证已经提交过的验证 List <RecheckStatusDtlDto> recheckStatusDtlList = recheckService.GetShopRecheckStautsDtl(recheckStatusDtl.ProjectId.ToString(), recheckStatusDtl.ShopId.ToString(), recheckStatusDtl.RecheckTypeId.ToString()); if (recheckStatusDtlList != null && recheckStatusDtlList.Count != 0) { throw new Exception("该经销商已提交复审,请勿重复提交"); } recheckService.SaveRecheckStatusDtl(recheckStatusDtl); return(new APIResult() { Status = true, Body = "" }); } catch (Exception ex) { return(new APIResult() { Status = false, Body = ex.Message.ToString() }); } }
public void SaveRecheckStatusDtl(RecheckStatusDtl statusDtl) { RecheckStatusDtl findOne = db.RecheckStatusDtl.Where(x => (x.ProjectId == statusDtl.ProjectId && x.ShopId == statusDtl.ShopId && x.RecheckTypeId == statusDtl.RecheckTypeId)).FirstOrDefault(); if (findOne == null) { statusDtl.InDateTime = DateTime.Now; db.RecheckStatusDtl.Add(statusDtl); } db.SaveChanges(); }