// POST api/values
 public IHttpActionResult Post([FromBody] MailModel mail)
 {
     mail.To   = "Admin";
     mail.Date = DateTime.Now;
     mailModelService.InsertMail(mail);
     return(Ok("Success"));
 }
Example #2
0
 public ActionResult SendRequeset()
 {
     if (Session["uname"] != null)
     {
         MailModel mailModel = new MailModel();
         mailModel.To      = "Admin";
         mailModel.From    = Session["id"].ToString();
         mailModel.Subject = "Update Request";
         mailModel.Body    = "<a>You Have got an Update Request From " + mailModel.From + "</a>";
         mailModel.Date    = DateTime.Now;
         mailModel.Status  = 1;
         mailModelService.InsertMail(mailModel);
         RequestUpdate requestUpdate = new RequestUpdate();
         requestUpdate.Phone   = Request["PhoneNumber"];
         requestUpdate.NID     = Request["NationalId"];
         requestUpdate.DOB     = Convert.ToDateTime(Request["Birthday"]);
         requestUpdate.Address = Request["Address"];
         requestUpdate.Name    = Request["Name"];
         requestUpdate.Id      = Session["id"].ToString();
         if (requestUpdateService.Get(requestUpdate.Id) != null)
         {
             requestUpdateService.Delete(requestUpdate.Id);
             requestUpdateService.Insert(requestUpdate);
         }
         else
         {
             requestUpdateService.Insert(requestUpdate);
         }
         TempData["Reply"] = "Your request has been sent to the proper authority";
         return(RedirectToAction("EditProfile", "Manager"));
     }
     return(RedirectToAction("Index", "Home"));
 }
        public ActionResult SendMail()
        {
            MailModelService mailModel = new MailModelService();
            MailModel        model     = new MailModel();

            model.To      = Request["to"];
            model.From    = Session["From"].ToString();
            model.Subject = Request["subject"];
            model.Body    = Request["body"];
            model.Date    = DateTime.Now;
            mailModelService.InsertMail(model);
            ViewBag.status = "Mail Has been Sent Successfully";
            return(View());
        }