/// <summary> /// /// </summary> /// <returns></returns> public ActionResult ListTypes() { try { var list = ArmorTypeRepository.List(); return(Json(list, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { Success = false }, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// Saves the specified armor. /// </summary> /// <param name="armor">The armor.</param> /// <returns></returns> public ActionResult Save(Armor armor) { try { var typeId = Int32.Parse(Request.Form["TypeId"]); var availId = Int32.Parse(Request.Form["AvailabilityId"]); armor.Type = ArmorTypeRepository.Retrieve(typeId); armor.Availability = ArmorAvailabilityRepository.Retrieve(availId); ArmorRepository.Save(armor); ArmorRepository.Session.Flush(); return(Json(new { Success = true, Message = "Armor saved successfully" }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { Success = false, Message = ex.Message }, JsonRequestBehavior.AllowGet)); } }