public IHttpActionResult saveChanges() { var httpRequest = HttpContext.Current.Request; // System.Diagnostics.Debug.WriteLine(httpRequest.Params["product"]); var donation = new JavaScriptSerializer().DeserializeObject(httpRequest.Params["donation"]); var dictionary = (Dictionary <string, object>)donation; DTO.Donations d = new DTO.Donations(); d.donationCode = (int)dictionary["donationCode"]; d.Description = (string)dictionary["Description"]; d.donationName = (string)dictionary["donationName"]; string imageName = null; //Upload Image var postedFile = httpRequest.Files["Image"]; //Create custom filename if (postedFile != null) { imageName = new String(Path.GetFileNameWithoutExtension(postedFile.FileName).Take(10).ToArray()).Replace(" ", "-"); imageName = imageName + DateTime.Now.ToString("yymmssfff") + Path.GetExtension(postedFile.FileName); var filePath = HttpContext.Current.Server.MapPath("~/image/" + imageName); postedFile.SaveAs(filePath); d.Picture = postedFile.FileName; } return(Ok(BL.donationsBL.saveChanges(d))); }
public static DAL.Donations convertToDAL(DTO.Donations d) { return(new DAL.Donations { Adress = d.Adress, Category = d.Category, Description = d.Description, donationCode = d.donationCode, donationName = d.donationName, donorName = d.donorName, donorEmail = d.donorEmail, // MasterCategory = d.MasterCategory, Phone = d.Phone, Picture = d.Picture }); }
public static void offerDonationMail(string subject, DTO.Donations donation, DAL.GMH gmh) { string email = "*****@*****.**"; string password = "******"; //string email = ConfigurationManager.AppSettings["emailAddress"]; // string password = ConfigurationManager.AppSettings["emailPassword"]; // string Body = System.IO.File.ReadAllText(HttpContext.Current.Server.MapPath("http://*****:*****@" <div dir=' ltr'> <h1>מצאנו תרומה תואמת לבקשתך!</h1> <div style=' position: relative; padding: 0.75rem 1.25rem; margin-bottom: 1rem; border: 1px solid transparent; border-radius: 0.25rem; color: #0c5460; width: 50%; background-color: #d1ecf1; border-color: #bee5eb;' > <h3>במידה ואתה לוקח את התרומה אשר את קבלתה</h3> <h2>פרטי תרומה</h2> <label>שם: {0} </label> <br /> <label> תיאור: {1}</ label> <br /> <img [src]='https://localhost:44360/image/{2}' /> <br /> <br /> <h2>פרטי מוסר</h2> <label> שם: {3}</label> <br /> <label> כתובת:{4}</ label> <br /> <label> פלאפון: {5}</label> <br /> <label> אימייל:{6}</label> <br /> <br /> </div> <div> <div style='display: inline-block;'> <form action= 'https://localhost:44360/api/donation/donationAnswer/true/{7}/{8}' method ='post' > <button type='submit' style='display: inline-block; font-weight: 400; text-align: center; vertical-align: middle; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; border: 1px solid transparent; padding: 0.375rem 0.75rem; font-size: 1rem; line-height: 1.5; border-radius: 0.25rem; transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; color: #fff; background-color: #28a745; border-color: #28a745;'> אני לוקח </button> </form> </div> <form action= 'https://localhost:44360/api/donation/donationAnswer/false/{7}/{8}' method ='post'> <button type='submit' style='display: inline-block; font-weight: 400; text-align: center; vertical-align: middle; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; border: 1px solid transparent; padding: 0.375rem 0.75rem; font-size: 1rem; line-height: 1.5; border-radius: 0.25rem; transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; color: #fff; background-color: #dc3545; border-color: #dc3545;'> לא רלוונטי </button> </form> </div> </div> " , donation.donationName, donation.Description, donation.Picture, donation.donorName, donation.Adress, donation.Phone, donation.donorEmail, gmh.UserCode, donation.donationCode ); msg.IsBodyHtml = true; smtpClient.EnableSsl = true; smtpClient.UseDefaultCredentials = false; smtpClient.Credentials = loginInfo; smtpClient.Send(msg); }
public IHttpActionResult DeleteDonation(DTO.Donations d) { return(Ok(BL.donationsBL.RemoveDonation(d))); }