public static void InsertInto(this object o, string table, ConnectionProfile connectionProfile = null) { if (connectionProfile == null) connectionProfile = new ConnectionProfile(); DynamicModel dynamicModel = new DynamicModel(connectionProfile, table, "Id"); dynamicModel.Insert(o); }
private NyResult Register(string email, string password, string reason) { var result = this.users.Register(email, password, password); if (result.Success) { // Add approval request and send a notification email try { var db = new DynamicModel("NietoYostenDb", "ApprovalRequests"); db.Insert(new { UserID = result.User.ID, Reason = reason }); this.SendNewUserRegistrationNotificationToAdmins(email, reason); } catch (Exception ex) { ErrorSignal.FromCurrentContext().Raise(ex); return new NyResult { Success = false, Message = "Ocurrió un error al solicitar la aprovación del usuario." }; } return new NyResult { Success = true, Message = result.Message }; } return new NyResult { Success = false, Message = result.Message }; }
public void SaveTable(DynamicModel table, List<dynamic> items ) { foreach (dynamic item in items) { if (item.State == RowState.New) { table.Insert(item); } else if(item.State == RowState.Updated) { table.Update(item, item.ID); } } }
public ActionResult Register(string email, string password, string confirm, string reason) { var result = this.users.Register(email, password, confirm); if (result.Success) { // Add approval request and send a notification email try { var db = new DynamicModel("NietoYostenDb", "ApprovalRequests"); db.Insert(new {UserID = result.User.ID, Reason = reason}); SendNewUserRegistrationNotificationToAdmins(email, reason); } catch (Exception ex) { ErrorSignal.FromCurrentContext().Raise(ex); this.SetAlertMessage("Ocurrió un error al solicitar la aprovación del usuario.", AlertClass.AlertDanger); return View(); } NyUtil.SetAlertMessage(this, result.Message, AlertClass.AlertSuccess); return RedirectToAction("Index", "Home"); } NyUtil.SetAlertMessage(this, result.Message, AlertClass.AlertDanger); return View(); }