public IActionResult AddPatientTodoItem(string itemName, string itemType, string kabanItemDescription, string createdItemTimeStamp, string patientName, string careGiverName) { var itemTypee = KabanItemType.Drug; if (itemType == KabanItemType.Exercise.ToString()) { itemTypee = KabanItemType.Exercise; } else if (itemType == KabanItemType.Meal.ToString()) { itemTypee = KabanItemType.Meal; } else if (itemType == KabanItemType.Miscellenous.ToString()) { itemTypee = KabanItemType.Miscellenous; } var kabanItem = new KabanItem { ItemType = itemTypee, ItemName = itemName, KabanitemDescription = kabanItemDescription, CreatedItemTimeStamp = createdItemTimeStamp, DoneItemTimeStamp = null, PatientName = patientName, CareGiverName = careGiverName, Status = "Open" }; _shevaHcRepo.AddKabanItem(kabanItem); _shevaHcRepo.SaveDataBaseChanges(); return(Json("Kaban Data Item Added")); }
public IActionResult ModifyKabanItem([FromBody] KabanCrudParams param) { var value = param.Value; if (param.Action == "insert" || (param.Action == "batch" && (param.Added.Count > 0))) { if (param.Added != null && param.Added.Count > 0) { foreach (var kabanItem in param.Added) { _shevaHcRepo.AddKabanItem(kabanItem); } } _shevaHcRepo.SaveDataBaseChanges(); return(Json("Kaban Data Item Added")); } if ((param.Action == "remove") || (param.Action == "batch" && (param.Deleted.Count > 0))) { foreach (var kabanItem in param.Deleted) { var oldKabanItem = _shevaHcRepo .GetAllKabanItems().SingleOrDefault(oKi => oKi.KabanItemID == kabanItem.KabanItemID); if (oldKabanItem != null) { _context.KabanItemsData.Remove(oldKabanItem); } } _shevaHcRepo.SaveDataBaseChanges(); } if (param.Changed != null && param.Changed.Count > 0) { foreach (var kabanItem in param.Changed) { var oldKItem = _shevaHcRepo .GetAllKabanItems().SingleOrDefault(oKItem => oKItem.KabanItemID == kabanItem.KabanItemID); if (oldKItem != null) { KabanItem updateKabanItem = _context.KabanItemsData.Single(k => k.KabanItemID == kabanItem.KabanItemID); updateKabanItem.Status = kabanItem.Status; if (kabanItem.Status == "Done") { updateKabanItem.DoneItemTimeStamp = DateTime.Now.ToString("g"); } } } } _shevaHcRepo.SaveDataBaseChanges(); return(Json("Modification Succeeded")); }