/// <summary> /// Метод за запис на доказателство към дело /// </summary> /// <param name="model"></param> /// <returns></returns> public bool CaseEvidence_SaveData(CaseEvidence model) { try { if (model.Id > 0) { //Update var saved = repo.GetById <CaseEvidence>(model.Id); saved.EvidenceTypeId = model.EvidenceTypeId; saved.FileNumber = model.FileNumber; saved.DateAccept = model.DateAccept; saved.Description = model.Description; saved.AddInfo = model.AddInfo; saved.Location = model.Location; saved.EvidenceStateId = model.EvidenceStateId; saved.DateWrt = DateTime.Now; saved.UserId = userContext.UserId; repo.Update(saved); repo.SaveChanges(); } else { //Insert if (counterService.Counter_GetEvidenceCounter(model, userContext.CourtId)) { model.DateWrt = DateTime.Now; model.UserId = userContext.UserId; repo.Add <CaseEvidence>(model); repo.SaveChanges(); } else { return(false); } } return(true); } catch (Exception ex) { logger.LogError(ex, $"Грешка при запис на доказателство по дело Id={ model.Id }"); return(false); } }