public void AddAid(AidTypes aidType, string description , DateTime aidDate, double amount, string notes , string createdBy) { Guard.StringIsNull <ArgumentNullException>(description, nameof(description)); Guard.LessThanZero(amount, nameof(amount)); if (aidType == AidTypes.Finacial) { Guard.LessThanOrEqualZero(amount, nameof(amount)); } var aid = new Aid { AidAmount = amount, AidDate = aidDate, AidDescription = description, AidType = aidType, Id = Guid.NewGuid(), CaseId = Id, CreatedDate = DateTime.Now, CreatedBy = createdBy, Notes = notes, }; CaseAids.Add(aid); }
public void UpdateAid(Guid aidId, AidTypes aidType, string description, DateTime aidDate , double amount, string notes , string updatedBy) { Guard.GuidIsEmpty <ArgumentNullException>(aidId, nameof(aidId)); Guard.StringIsNull <ArgumentNullException>(description, nameof(description)); var aid = CaseAids.FirstOrDefault(c => c.Id == aidId); if (aid == null) { throw new ArgumentException("Aid is not exist.", nameof(aidId)); } if (aid.AidType == AidTypes.Finacial) { Guard.LessThanOrEqualZero(amount, nameof(amount)); } aid.AidAmount = amount; aid.AidType = aidType; aid.AidDate = aidDate; aid.AidDescription = description; aid.UpdatedDate = DateTime.Now; aid.UpdatedBy = updatedBy; }