/// <summary> /// Adds a Allergy to the Repository. /// </summary> /// <param name="entity">The Allergy to add to the Repository.</param> public void Add(Allergy entity) { Session.Save(entity); }
/// <summary> /// Removes a Allergy from the Repository. /// </summary> /// <param name="entity">The Allergy to remove from the Repository.</param> public void Remove(Allergy entity) { Session.Delete(entity); }
/// <summary> /// Create new allergy /// </summary> /// <returns></returns> public JsonResult CreateNewAllergy() { try { AllergyRepository allergy = new AllergyRepository(); Allergy newAllergy = new Allergy(); newAllergy.Name = Request.Form["AllergyName"]; newAllergy.IsActive = true; allergy.Add(newAllergy); return Json(new { error = false, status = "Added new allergy successfully!", newAllergy.Id, newAllergy.Name }); } catch (Exception e) { return Json(new { error = "true", status = "Unable to add allergy!", errorMessage = e.Message }); } }