public ActionResult Add(PickModel model) { if (ModelState.IsValid) { return(View(model)); } return(View(model)); }
public IActionResult getPicklist(string type) { List <PickModel> list = new List <PickModel>(); switch (type) { case "paytype": List <PayType> typelist = new List <PayType>(); typelist = (from pay in _personalContext.PayType where pay.State == false select pay).ToList(); if (typelist.Count > 0) { foreach (PayType item in typelist) { PickModel model = new PickModel(); model = _mapper.Map <PickModel>(item); list.Add(model); } } break; case "customtype": List <CustomType> customlist = new List <CustomType>(); customlist = (from custom in _personalContext.CustomType where custom.State == false select custom).ToList(); if (customlist.Count > 0) { foreach (CustomType item in customlist) { PickModel model = new PickModel(); model = _mapper.Map <PickModel>(item); list.Add(model); } } break; default: break; } return(Ok(list)); }
/// <summary> /// Creates a new pick. /// </summary> /// <param name="givenModel"> The PickModel that holds data about this Pick.</param> public Pick(PickModel givenModel) { this.model = givenModel; }