public JsonResult AddLocation() { try { Location loc = new Location(); loc.Department = Request.Form["Department"]; loc.RoomNumber = Request.Form["RoomNumber"]; loc.IsActive = true; LocationRepository locationRepo = new LocationRepository(); locationRepo.Add(loc); return Json(new { error = false, Id = loc.Id, Name = loc.Department }); } catch { return Json(new { error = true }); } }
/// <summary> /// Get the list of active checkins. /// </summary> /// <returns>A Json object containing the list of active checkins.</returns> public JsonResult ActiveCheckIns() { try { PatientRepository patientRepo = new PatientRepository(); string department = Request.Form["loc"]; var myLocation = new Location(); myLocation.Department = department; var list = patientRepo.FindByLocation(myLocation); //var resultList = from test in list select test; var bob = new List<object>(); foreach (var patient in list) { bob.Add(new {Name=patient.LastName +", " + patient.FirstName, ID=patient.Id }); } return Json(new { error = "false", status = "Successfully.", //loc.Department //list //resultList bob }); //return Json(list); } catch (Exception ex) { return Json(new { error = "true", status = "Didnt work" }); } }
/// <summary> /// Removes a Location from the Repository. /// </summary> /// <param name="entity">The Location to remove from the Repository.</param> public void Remove(Location entity) { Session.Delete(entity); }
/// <summary> /// Adds a Location to the Repository. /// </summary> /// <param name="entity">The Location to add to the Repository.</param> public void Add(Location entity) { Session.Save(entity); }