public ActionResult SaveChanges(TopModel model) { if (!ModelState.IsValid) { return(null); } T_Top entity = TopModel.ModelToEntity(model); // Save add action if (model.top_id <= 0) { _context.Add(entity); _context.SaveChanges(); Log.Info(string.Format("Edit top id={0} name={1}", entity.top_id, entity.top_title)); return(GenerateJson(entity, true, "Nouveau classement ajouté.")); } // Save edit action else { _context.Edit(entity); _context.SaveChanges(); Log.Info(string.Format("Create top id={0} name={1}", entity.top_id, entity.top_title)); return(GenerateJson(entity, false, "Classement modifié.")); } }
public void CascadeRebind(int it, int im, int ib, string st) { TopModel.rebind(it, st); MiddleModel.rebind(im, st, TopModel.SelectedValue); BottomModel.rebind(ib, st, TopModel.SelectedValue, MiddleModel.SelectedValue); setFeedback(); }
public ActionResult SaveChanges(TopModel model) { if (!ModelState.IsValid) return null; T_Top entity = TopModel.ModelToEntity(model); // Save add action if (model.top_id <= 0) { _context.Add(entity); _context.SaveChanges(); Log.Info(string.Format("Edit top id={0} name={1}", entity.top_id, entity.top_title)); return GenerateJson(entity, true, "Nouveau classement ajouté."); } // Save edit action else { _context.Edit(entity); _context.SaveChanges(); Log.Info(string.Format("Create top id={0} name={1}", entity.top_id, entity.top_title)); return GenerateJson(entity, false, "Classement modifié."); } }
public async Task <ActionResult> GetTop(int?count) { TopModel model = new TopModel(); ApiClient client = new ApiClient(); List <string> players = await client.GetTop(count); model.Players = players; return(View(model)); }
public TopModel GetTop(Guid userId, int top = 10) { bl_User blUser = new bl_User(); TopModel model = new TopModel(); model.CurrentUser = new UserProfile(blUser.GetById(userId)); model.UserList = blUser.GetTop(10) .Select(m => new UserProfile(m)) .ToList(); return(model); }
protected void Page_Load(object sender, EventArgs e) { user = (User)Session[Constants.Session_CurrentUser]; if (!PagePermissions.IsAllowedOnPage(this, user)) { Response.Redirect(PagePermissions.TransferToPage(this, user), true); } tbDesignerName.Focus(); //TODO we need a better way of updating the local topmodel db Top = new TopModel(); lblInvalidDesignerName.Visible = false; lblInvalidNeckSize.Visible = false; lblInvalidSleeveSize.Visible = false; lblInvalidChestSize.Visible = false; lblTroubleAddingItem.Visible = false; }
public TopModel GetTopByZingUser(string userName, int top = 10) { bl_User blUser = new bl_User(); TopModel model = new TopModel(); //var user = blUser.GetByUserName("zing." + userName); var user = blUser.GetByUserName(userName); if (user != null) { model.CurrentUser = new UserProfile(user); } else { model.CurrentUser = null; } model.UserList = blUser.GetTop(10) .Select(m => new UserProfile(m)) .ToList(); return(model); }
public ActionResult Edit(int id) { return(PartialView("Manager", TopModel.EntityToModel(_context.GetById(id)))); }
private void setFeedback() { TopModel.SetFeedback(); MiddleModel.SetFeedback(); BottomModel.SetFeedback(); }
public void SuperSelected(params string[] dependants) { clearAll(); TopModel.bind(dependants); setFeedback(); }
private void clearAll() { TopModel.clear(); MiddleModel.clear(); BottomModel.clear(); }
protected override void SetEngineApiAccess() { _engineApiAccess = new TopModel(); }
public ActionResult TopForm() { TopModel model = new TopModel(); return(View(model)); }
// GET: Top public ActionResult Index() { TopModel model = new TopModel(); return(PartialView(model)); }