public Checklist insert(Checklist checklist) { Checklist newChecklist = _checklistRepo.InsertChecklist(checklist); bool isSaved = _checklistRepo.Save(); if ((newChecklist != null) && isSaved) { return(newChecklist); } return(null); }
public Item insert(int checklistId, Item item) { //Find checklist Checklist checklist = _checklistRepo.GetChecklistById(checklistId) .Include("Items") .ToList() .FirstOrDefault(); item.ChecklistId = checklistId; foreach (var translation in item.Translations.ToList()) { _translationRepo.InsertTranslation(translation); } _itemRepo.InsertItem(item); checklist.Items.Add(item); _checklistRepo.UpdateChecklist(checklistId, checklist); if (_checklistRepo.Save()) { return(item); } return(null); }