Пример #1
0
        public ActionResult Activation(int id)
        {
            var result = _context.Registers.Where(x => x.Id == id).FirstOrDefault();

            result.Code = "True";
            _context.Entry(result).State = System.Data.Entity.EntityState.Modified;
            _context.SaveChanges();
            return(View("Login"));
        }
Пример #2
0
        public ActionResult ApproveNote(int id)
        {
            ViewBag.status = id;
            var result = _context.SellNotes.Where(x => x.Id == id).FirstOrDefault();

            if (result != null)
            {
                result.Status = "Published";
                _context.Entry(result).State = System.Data.Entity.EntityState.Modified;
                _context.SaveChanges();
            }
            return(RedirectToAction("NoteUnderReview"));
        }
        public ActionResult updateNote(SellNote model, FormCollection fc, HttpPostedFileBase imgfile, HttpPostedFileBase pdffile)
        {
            if (ModelState.IsValid)
            {
                var currenttime = DateTime.UtcNow;
                if (imgfile != null)
                {
                    model.Display_pic = new byte[imgfile.ContentLength];
                    imgfile.InputStream.Read(model.Display_pic, 0, imgfile.ContentLength);
                }
                if (pdffile != null)
                {
                    String FileExt = Path.GetExtension(pdffile.FileName).ToUpper();
                    if (FileExt == ".PDF")
                    {
                        Stream       str     = pdffile.InputStream;
                        BinaryReader Br      = new BinaryReader(str);
                        Byte[]       FileDet = Br.ReadBytes((Int32)str.Length);
                        model.FileName    = pdffile.FileName;
                        model.Upload_note = FileDet;
                    }
                }
                if (fc["save"] == "SAVE")
                {
                    model.Status = "Draft";
                }
                if (fc["publish"] == "PUBLISH")
                {
                    model.Status = " Submitted for Review";
                }
                var res = _context.Registers.Where(x => x.EmailId == User.Identity.Name).Single().Id;
                model.Seller_Id    = res;
                model.ModifiedDate = currenttime;

                model.Seller_Id             = _context.Registers.Where(x => x.EmailId == User.Identity.Name).Single().Id;
                _context.Entry(model).State = System.Data.Entity.EntityState.Modified;
                _context.SaveChanges();
                return(Redirect("ViewNotes"));
            }
            else
            {
                return(View());
            }
        }