Exemplo n.º 1
0
        public ActionResult Create(reclamation re)
        {
            string role = null;

            ViewData["Role"] = "";
            IEnumerable <string> roles = new List <string>();

            roles = ((ClaimsIdentity)User.Identity).Claims
                    .Where(c => c.Type == ClaimTypes.Role)
                    .Select(c => c.Value);
            foreach (var x in roles)
            {
                role = x;
            }

            if (role != null)
            {
                ViewData["Role"] = role;
            }
            re.user_idUser = User.Identity.GetUserId();
            re.dateSubmit  = DateTime.Now;
            var file = Request.Files[0];

            if (file != null && file.ContentLength > 0)
            {
                var    fileName = Path.GetFileName(file.FileName);
                var    path     = Path.Combine(Server.MapPath("~/Reclamations/"), fileName);
                string x        = fileName;
                re.reclamationPath = x;
                file.SaveAs(path);
            }
            rec.Add(re);
            rec.Commit();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public ActionResult Reclamation(ViewReclamationModel rvm)
        {
            SU = new ServiceUser();
            rs = new ServiceReclamation();
            reclamation r = new reclamation();

            r.description = rvm.description;
            r.sujet       = rvm.sujet;

            rs.Add(r);
            rs.Commit();

            SU.email(rvm.Email, rvm.Password, rvm.sujet, rvm.description);
            ViewBag.Message = "Your Profile page.";

            return(View());
        }