Exemplo n.º 1
0
        public ActionResult ChangeTitle(int id, string title)
        {
            var context = new ElContext();
            var post = context.Posts.First(r => r.Id == id);
            post.Title = title;
            context.SaveChanges();

            return Json(true);
        }
Exemplo n.º 2
0
        public ActionResult EditPost(Post item)
        {
            var context = new ElContext();
            var post = context.Posts.First(r => r.Id == item.Id);
            post.Title = item.Title;
            post.Text = item.Text;
            context.SaveChanges();

            return RedirectToAction("Index");
        }
Exemplo n.º 3
0
 public static void UnregisterScannerActivity()
 {
     try
     {
         ElContext?.UnregisterReceiver(Receiver);
     }
     catch { }
     AfterReceive?.GetInvocationList().ToList().ForEach(x => AfterReceive   -= (EventHandler <ReceiveEventArgs>)x);
     BeforeReceive?.GetInvocationList().ToList().ForEach(x => BeforeReceive -= (EventHandler)x);
     ElContext = null;
     ARP       = null;
 }
Exemplo n.º 4
0
        public ActionResult AddPost(PostInput item)
        {
            var context = new ElContext();
            var post = new Post();
            post.Title = item.Title;
            post.Text = item.Text;
            post.DateTime = DateTime.Now;
            post.Active = true;

            var guid = Guid.NewGuid();
            item.Image.SaveAs(HttpContext.Server.MapPath("~/Content/" + guid + ".jpg"));
            post.Images.Add(new Image { Path = "Content/" + guid + ".jpg", PostId = post.Id });

            context.Posts.Add(post);
            context.SaveChanges();

            return RedirectToAction("Index");
        }
Exemplo n.º 5
0
        private static void Scanner_AfterReceive(object sender, ReceiveEventArgs e)
        {
            var l = RootView.EditTextList();
            //var c = root.FocusedEditText();
            var _keyIndex = l.FindIndex(a => a.IsFocused == true);

            if (_keyIndex != -1)
            {
                ElContext.RunOnUiThread(() =>
                {
                    l[_keyIndex].Text = e.ReceivedData;
                    l[_keyIndex].SetSelection(l[_keyIndex].Text.Length);
                    if (!e.Silent)
                    {
                        cSounds.Correct(ElContext);
                    }
                    if (_keyIndex < l.Count - 1) //move the focus to the next edittext view
                    {
                        l[_keyIndex + 1].RequestFocus();
                    }
                    else
                    {
                        var _res = ARP?.Invoke(e.ReceivedData);
                        if (_res == false)
                        {
                            l.ForEach(et => et.Text = "");
                            l[0].RequestFocus();
                        }
                    }
                    //c.DispatchKeyEvent(new KeyEvent(0, 0, KeyEventActions.Down, KeyEvent.KeyCodeFromString("KEYCODE_ENTER"), 0));
                });
            }
            else
            {
                if (!e.Silent)
                {
                    cSounds.Error(ElContext);
                }
            }
            ((Activity)sender).RunOnUiThread(() => RootView.EditTextList().ForEach(et => et.Enabled = true));
        }
Exemplo n.º 6
0
 public ActionResult Index()
 {
     var db = new ElContext();
     var items = db.Posts.Where(r => r.Active).ToList();
     return View("Notes", items);
 }
Exemplo n.º 7
0
 public HomeController(ElContext ec)
 {
     context = ec;
 }
Exemplo n.º 8
0
        public ActionResult MarkInactive(int id)
        {
            var context = new ElContext();
            var post = context.Posts.First(r => r.Id == id);
            post.Active = false;
            context.SaveChanges();

            return RedirectToAction("Index");
        }
Exemplo n.º 9
0
        public ActionResult Index()
        {
            var posts = new ElContext().Posts.Where(r => r.Active).ToList();

            return View("Index", posts);
        }
Exemplo n.º 10
0
 public ActionResult EditPost(int id)
 {
     var post = new ElContext().Posts.First(r => r.Id == id);
     return View("EditPost", post);
 }