public ActionResult SaveHomeImages(HomeImageViewModel Input) { try { var Date = DateTime.Now.ToFileTimeUtc(); using (TouchContext touch = new TouchContext()) { var obj = touch.HomeImages.Where(a => a.Id == Input.Id).FirstOrDefault(); obj.Title = Input.Title; obj.Description = Input.Description; obj.IsActive = Input.IsActive; if (Input.PicturePath != null) { string[] Arr = Input.PicturePath.FileName.Split('.'); Input.PicturePath.SaveAs(HttpContext.Server.MapPath("~/Images/backgrounds/") + Arr[0] + Date + "_L." + Arr[1]); Bitmap b = new Bitmap(Input.PicturePath.InputStream); var resizedImage = Helpers.ImageResizeHelper.ResizeBitmap(b, 100, 100); resizedImage.Save(HttpContext.Server.MapPath("~/Images/backgrounds/SmallBackGround/") + Arr[0] + Date + "_S." + Arr[1]); obj.PicturePath = Arr[0] + Date; obj.Extention = Arr[1]; } touch.Entry(obj).State = EntityState.Modified; touch.SaveChanges(); } } catch (Exception ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } return(Json(true, JsonRequestBehavior.AllowGet)); }
public ActionResult AddCareer(CareerInfo career) { using (TouchContext db = new TouchContext()) { //db.CareerInformation.Add(career); //var obj = db.CareerInformation.Where(a => a.Id == career.Id).FirstOrDefault(); db.Entry(career).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("JobApplication")); } }
public ActionResult EditProfile(CompanyProfile input) { try { using (TouchContext touch = new TouchContext()) { touch.Entry(input).State = EntityState.Modified; touch.SaveChanges(); return(Redirect("~/Admin/CompanyProfile")); } } catch (Exception ex) { throw; } }
public ActionResult Editvip(VipService input) { try { using (TouchContext touch = new TouchContext()) { touch.Entry(input).State = EntityState.Modified; touch.SaveChanges(); return(RedirectToAction("vip")); } } catch (Exception ex) { throw; } }
public ActionResult ReadMessage(int id) { try { using (TouchContext touch = new TouchContext()) { var View = touch.ContactUsMessages.FirstOrDefault(a => a.Id == id); View.IsRead = true; touch.Entry(View).State = EntityState.Modified; touch.SaveChanges(); return(Json(View, JsonRequestBehavior.AllowGet)); } } catch (Exception) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult Savemember(TeamMemberViewModel Input) { try { using (TouchContext touch = new TouchContext()) { var obj = touch.TeamMembers.Where(a => a.Id == Input.Id).FirstOrDefault(); obj.Id = Input.Id; obj.Name = Input.Name; obj.Position = Input.Position; obj.Details = Input.Details; obj.Email = Input.Email; obj.Phone = Input.Phone; var Date = DateTime.Now.ToFileTimeUtc(); if (Input.PicturePath != null) { string[] Arr = Input.PicturePath.FileName.Split('.'); Input.PicturePath.SaveAs(HttpContext.Server.MapPath("~/Images/Profile/") + Arr[0] + Date + "_L." + Arr[1]); Bitmap b = new Bitmap(Input.PicturePath.InputStream); var resizedImage = Helpers.ImageResizeHelper.ResizeBitmap(b, 100, 100); resizedImage.Save(HttpContext.Server.MapPath("~/Images/Profile/Display/") + Arr[0] + Date + "_S." + Arr[1]); obj.PicturePath = Arr[0] + Date; obj.Extention = Arr[1]; } if (Input.CvPath != null) { Input.CvPath.SaveAs(HttpContext.Server.MapPath("~/File/MemberCv/") + Input.CvPath.FileName); obj.CvPath = Input.CvPath.FileName; } touch.Entry(obj).State = EntityState.Modified; touch.SaveChanges(); } } catch (Exception ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } return(Json(true, JsonRequestBehavior.AllowGet)); }
public ActionResult ContactUs(ContactUs Input) { try { if (Input.Id == 0) { Touch.ContactUs.Add(Input); Touch.SaveChanges(); } else { Touch.Entry(Input).State = EntityState.Modified; Touch.SaveChanges(); } return(view(Input)); } catch (Exception ex) { throw; } return(Redirect("~/Admine/Index")); }
public HttpStatusCodeResult SocialLink(SocialLink input) { try { using (TouchContext db = new TouchContext()) { if (input.Id > 0) { db.Entry(input).State = EntityState.Modified; } else { db.SocialLinks.Add(input); } db.SaveChanges(); } } catch (Exception) { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError)); // throw; } return(new HttpStatusCodeResult(HttpStatusCode.OK)); }