public ActionResult Add(NotesModel model)
        {
            //if model contains value for ID then edit record or create new record
            using (entity.encoraEntities context = new entity.encoraEntities())
            {
                entity.note note = null;
                if (model.ID > 0)
                {
                    note             = context.notes.Where(o => o.id == model.ID).FirstOrDefault();
                    note.description = model.Description;
                    note.isArchived  = model.isArchived;
                    note.modified    = DateTime.Now;
                    ViewBag.Message  = "Data updated successfully";
                }
                else
                {
                    note = context.notes.Create();

                    note.description = model.Description;
                    note.userID      = Convert.ToInt32(Session["UserID"]);
                    note.created     = DateTime.Now;
                    note.modified    = DateTime.Now;
                    note.isArchived  = model.isArchived;
                    context.notes.Add(note);
                    ViewBag.Message = "Data insert successfully";
                }

                context.SaveChanges();
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult Delete(int id)
        {
            entity.encoraEntities context = new entity.encoraEntities();

            var data = context.notes.Where(x => x.id == id).FirstOrDefault();

            context.notes.Remove(data);
            context.SaveChanges();

            ViewBag.Messsage = "Record delete successfully";
            return(RedirectToAction("Index"));
        }