public ActionResult Create([Bind(Include = "InfoID,MailAdress,Password,Name")] AdminProfil adminProfil) { if (ModelState.IsValid) { db.AdminProfils.Add(adminProfil); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(adminProfil)); }
public ActionResult Create([Bind(Include = "AdviceId,Title,Content,ImageURL,Date,AdviceTopicID")] Advice advice) { if (ModelState.IsValid) { db.Advices.Add(advice); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(advice)); }
public ActionResult Create([Bind(Include = "UserId,NameSurname,Gender,Email,Password,CountryNo,ImageURL")] User user) { if (ModelState.IsValid) { db.Users.Add(user); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(user)); }
public ActionResult Create([Bind(Include = "CountryId,CountryName")] Country country) { if (ModelState.IsValid) { db.Countries.Add(country); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(country)); }
public ActionResult Create([Bind(Include = "LocationId,LocationName,Content,Address,CountryId")] Tourism tourism) { if (ModelState.IsValid) { db.Tourisms.Add(tourism); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "CountryName", tourism.CountryId); return(View(tourism)); }
public ActionResult Create([Bind(Include = "TopicId,TopicTitle,ForumTopicTitleId")] ForumCommentTopic forumCommentTopic) { if (ModelState.IsValid) { db.ForumCommentTopics.Add(forumCommentTopic); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ForumTopicTitleId = new SelectList(db.ForumTopicTitles, "TitleId", "Text", forumCommentTopic.ForumTopicTitleId); return(View(forumCommentTopic)); }
public ActionResult Create([Bind(Include = "RestaurantId,RestaurantName,Content,Address,CoverImageURL,CountryId")] Restaurant restaurant) { if (ModelState.IsValid) { db.Restaurants.Add(restaurant); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "CountryName", restaurant.CountryId); return(View(restaurant)); }
public ActionResult Create([Bind(Include = "TitleId,Text,CommentCategoryId")] ForumTopicTitle forumTopicTitle) { if (ModelState.IsValid) { db.ForumTopicTitles.Add(forumTopicTitle); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CommentCategoryId = new SelectList(db.ForumCommentCategories, "CategoryId", "CategoryName", forumTopicTitle.CommentCategoryId); return(View(forumTopicTitle)); }
public ActionResult Create([Bind(Include = "ImageId,ImageURL,RestaurantId")] RestaurantImage restaurantImage) { if (ModelState.IsValid) { db.RestaurantImages.Add(restaurantImage); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.RestaurantId = new SelectList(db.Restaurants, "RestaurantId", "RestaurantName", restaurantImage.RestaurantId); return(View(restaurantImage)); }
public ActionResult Create([Bind(Include = "CategoryId,CategoryName,CountryId")] AdviceTopic adviceTopic) { if (ModelState.IsValid) { db.AdviceTopics.Add(adviceTopic); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "CountryName", adviceTopic.CountryId); return(View(adviceTopic)); }
public ActionResult Create([Bind(Include = "ImageId,ImageURL,LocationId")] LocationImage locationImage) { if (ModelState.IsValid) { db.LocationImages.Add(locationImage); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.LocationId = new SelectList(db.Tourisms, "LocationId", "LocationName", locationImage.LocationId); return(View(locationImage)); }
public ActionResult Create([Bind(Include = "CategoryId,CategoryName,CountryId")] ForumCommentCategory forumCommentCategory) { if (ModelState.IsValid) { db.ForumCommentCategories.Add(forumCommentCategory); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "CountryName", forumCommentCategory.CountryId); return(View(forumCommentCategory)); }
public ActionResult Create([Bind(Include = "CommentId,Content,UserId,LocationId,Permission")] LocationComment locationComment) { if (ModelState.IsValid) { db.LocationComments.Add(locationComment); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.LocationId = new SelectList(db.Tourisms, "LocationId", "LocationName", locationComment.LocationId); ViewBag.UserId = new SelectList(db.Users, "UserId", "NameSurname", locationComment.UserId); return(View(locationComment)); }
public ActionResult Create([Bind(Include = "ActivityId,ImageURL,Title,Content,Date,StartTime,FinishTime,Address,CountryId,UserId,Permission,Participation,NumberofParticipations")] Activity activity) { if (ModelState.IsValid) { db.Activities.Add(activity); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "CountryName", activity.CountryId); ViewBag.UserId = new SelectList(db.Users, "UserId", "NameSurname", activity.UserId); return(View(activity)); }
public ActionResult Create([Bind(Include = "CommentId,Content,UserId,RestaurantId")] RestaurantComment restaurantComment) { if (ModelState.IsValid) { db.RestaurantComments.Add(restaurantComment); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.RestaurantId = new SelectList(db.Restaurants, "RestaurantId", "RestaurantName", restaurantComment.RestaurantId); ViewBag.UserId = new SelectList(db.Users, "UserId", "NameSurname", restaurantComment.UserId); return(View(restaurantComment)); }
public ActionResult Create([Bind(Include = "CommentId,Content,UserId,CommentTopicId,Permission")] ForumComment forumComment) { if (ModelState.IsValid) { db.ForumComments.Add(forumComment); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserId = new SelectList(db.Users, "UserId", "NameSurname", forumComment.UserId); ViewBag.CommentTopicId = new SelectList(db.ForumCommentTopics, "TopicId", "TopicTitle", forumComment.CommentTopicId); return(View(forumComment)); }
//[HttpPost] public JsonResult AcceptDeny(int id, int sonuc) { PlatformContext db = new PlatformContext(); Activity a = new Activity(); int kullaniciId = (int)Session["EnterID"]; if (sonuc == 1) { var update = db.Activities.FirstOrDefault(x => x.ActivityId == id); var u = db.Users.Find(kullaniciId); update.Participants.Add(u); update.Participation = true; db.Entry(update).State = EntityState.Modified; db.SaveChanges(); //a.Participation = true; //a.ActivityId = id; //a.UserId = kullaniciId; return(Json(a)); } else { //a.Participation = false; //a.ActivityId = id; //a.UserId = kullaniciId; string message = ""; try { //DB Update işlemleri yapılacak //var update = db.Activities.Where(x => x.ActivityId == id); var update = db.Activities.FirstOrDefault(x => x.ActivityId == id && x.UserId == kullaniciId); update.Participation = false; db.SaveChanges(); message = "Success"; } catch (Exception ex) { message = "Error"; } return(Json(message)); //kim hangi etkinliğe katılıyor oonu onu bul onun üsütnden calış } }
public ActionResult RestaurantDetail(string Content, int id) { RestaurantComment rComment = new RestaurantComment(); rComment.Content = Content; rComment.RestaurantId = id; int idUser = Convert.ToInt32(Session["EnterID"]); rComment.User = db.Users.Find(idUser); db.RestaurantComments.Add(rComment); db.SaveChanges(); Restaurant rest = (from r in db.Restaurants where r.RestaurantId == id select r).FirstOrDefault(); ViewBag.Comment = db.RestaurantComments.Where(x => x.RestaurantId == id).ToList(); return(View(rest)); }
public ActionResult RenewalPassword(string NewPassword, string NewPasswordRepeat) { bool?Control = false; ViewBag.ControlPassword = "******"; if (NewPassword == NewPasswordRepeat) { string Mail = Request.QueryString["Mail"]; User Account = Db.Users.Where(x => x.Email == Mail).FirstOrDefault(); Account.Password = NewPassword; Db.Entry(Account).State = System.Data.Entity.EntityState.Modified; Db.SaveChanges(); Control = true; RedirectToAction("Index"); } return(View(Control)); }
public void DeleteNews(string newsId) { try { Guid guidId = Guid.Parse(newsId); var delNews = context.News.SingleOrDefault(n => n.Id == guidId); context.News.Remove(delNews); context.SaveChanges(); } catch (System.FormatException ex) { Logger.GetLogExeption(logger, ex, this); throw new Exception("GuidParseException " + ex.Message); } catch (Exception ex) { Logger.GetLogExeption(logger, ex, this); throw new Exception(ex.Message); } }
public ActionResult Create(string name, DateTime date, DateTime StartTime, DateTime FinishTime, HttpPostedFileBase Image, string Content, string Address, int Kontejyan) { if ((Session["EnterID"] != null) || (Session["EnterID"] != null)) { PlatformContext db = new PlatformContext(); string klasor = Server.MapPath("/Uploads/Activity/"); Image.SaveAs(klasor + Image.FileName); Activity activity = new Activity(); activity.Address = Address; activity.Title = name; activity.StartTime = StartTime; activity.FinishTime = FinishTime; activity.Date = date; activity.CountryId = (int)Session["CountryId"]; activity.Content = Content; activity.ImageURL = "/Uploads/Activity/" + Image.FileName; activity.UserId = (int)Session["EnterID"]; activity.NumberofParticipations = Kontejyan; if (ModelState.IsValid) { try { db.Activities.Add(activity); try { db.SaveChanges(); } catch (DbUpdateException ex1) { var b = ex1.InnerException; } } catch (DbEntityValidationException ex) { var a = ex.EntityValidationErrors; } return(RedirectToAction("Index", new { error = "Kaydınız oluşmutur.Yetkili kişi tarafından onaylandıktan sonra görünecektir" })); } //ViewBag.PossibleParents = db.Activities.ToList(); return(View()); } else { return(RedirectToAction("Index", "User")); } }
public ActionResult Comment(string Content, int id, int?DeleteID) { if (DeleteID != null) { ForumComment Comment = Db.ForumComments.Find(DeleteID); Db.ForumComments.Remove(Comment); Db.SaveChanges(); } if (Content != null) { ForumComment NewComment = new ForumComment(); int UserID = (int)Session["EnterID"]; User ByUser = Db.Users.Find(UserID); NewComment.ByUser = ByUser; NewComment.Content = Content; NewComment.CommentTopic = Db.ForumCommentTopics.Find(id); Db.ForumComments.Add(NewComment); Db.SaveChanges(); } ViewBag.Comment = Db.ForumComments.Where(x => x.CommentTopicId == id).ToList(); return(View()); }
public void SendFirstRequest(FirstRequest firstRequest) { Message newMessage = new Message(); newMessage.Applicant = firstRequest.Applicant; newMessage.Recipient = firstRequest.Recipient; newMessage.SupplyId = firstRequest.SupplyId; newMessage.NeedId = firstRequest.NeedId; newMessage.Time = firstRequest.Time; newMessage.MessageType = "First"; newMessage.MeaasgeState = "N"; newMessage.Items = new List <Item>(); for (int i = 0; i < firstRequest.Items.Count; i++) { newMessage.Items.Add(new Item()); } for (int i = 0; i < firstRequest.Items.Count; i++) { newMessage.Items[i].ItemName = firstRequest.Items[i].ItemName; newMessage.Items[i].ItemCount = firstRequest.Items[i].ItemCount; } platformContext.Messages.Add(newMessage); for (int i = 0; i < firstRequest.Items.Count; i++) { Exchange exchange = new Exchange(); exchange.Requestor = firstRequest.Applicant; exchange.Supplicant = firstRequest.Recipient; exchange.NeedId = firstRequest.NeedId; exchange.SupplyId = firstRequest.SupplyId; exchange.ItemName = firstRequest.Items[i].ItemName; exchange.ItemCount = Convert.ToString(firstRequest.Items[i].ItemCount); exchange.Type = "请求"; exchange.Time = firstRequest.Time; platformContext.Exchanges.Add(exchange); } platformContext.SaveChanges(); }
public ActionResult TourismTravelDetails(string comment, int id, int?UserId, int locationId) { ViewBag.c = (Session["EnterID"] == null); ViewBag.Name = UserId; //int a = (int)Session["EnterID"]; if (!string.IsNullOrEmpty(comment)) { LocationComment lc = new LocationComment(); lc.Content = comment; lc.LocationId = (int)locationId; lc.UserId = (int)UserId; db.LocationComments.Add(lc); db.SaveChanges(); } ViewBag.user = db.Users.Find(UserId); ViewBag.Comment = db.LocationComments.ToList(); ViewBag.Tourism = db.Tourisms.Where(x => x.CountryId == id); Tourism countries = (from c in db.Tourisms where c.CountryId == id select c).FirstOrDefault(); ViewBag.Comments = db.LocationComments.Where(x => x.LocationId == locationId & x.UserId == UserId); return(View(countries)); }
// GET: Panel/Profile public ActionResult Index(int?id, int?PersonID) { PlatformContext db = new PlatformContext(); User User = Db.Users.Find(id); if (PersonID != null) { User User2 = Db.Users.Find(PersonID); User2.Score = User2.Score + 1;//yardım ettiği kişi sayısı arttırılıyor Db.Entry(User2).State = System.Data.Entity.EntityState.Modified; Db.SaveChanges(); return(RedirectToAction("Index", "Home")); } ViewBag.CountryName = (Db.Countries.Where(x => x.CountryId == User.CountryNo).Select(x => x.CountryName)).FirstOrDefault(); return(View(User)); }
// GET: Panel/Profile public ActionResult Index(int?id, int?PersonID) {//profilde ilk kişinin profiline gidiliyor id ile daha sonra puan verilirse kişiye kişinin id si tekrar alınıyor person id ile yardım ettiği kişi sayısı arttırılıyor PlatformContext db = new PlatformContext(); User User = Db.Users.Find(id); if (PersonID != null) { User User2 = Db.Users.Find(PersonID); User2.Score = User2.Score + 1;//yardım ettiği kişi sayısı arttırılıyor Db.Entry(User2).State = System.Data.Entity.EntityState.Modified; Db.SaveChanges(); return(RedirectToAction("Index", "Home")); } ViewBag.CountryName = (Db.Countries.Where(x => x.CountryId == User.CountryNo).Select(x => x.CountryName)).FirstOrDefault();//profilinde ülkeside çıksın diye aldım return(View(User)); }
public void UpData() { for (int i = 0; i < days.Length; i++) { EveryDataAndNews everyDataAndNews = new EveryDataAndNews(); everyDataAndNews.Date = days[i]; everyDataAndNews.News = news[i]; everyDataAndNews.HuBei = datas[i, 0]; everyDataAndNews.GuangDong = datas[i, 1]; everyDataAndNews.ZheJiang = datas[i, 2]; everyDataAndNews.HuNan = datas[i, 3]; everyDataAndNews.HeNan = datas[i, 4]; everyDataAndNews.AnHui = datas[i, 5]; everyDataAndNews.ChongQing = datas[i, 6]; everyDataAndNews.ShanDong = datas[i, 7]; everyDataAndNews.JiangXi = datas[i, 8]; everyDataAndNews.SiChuan = datas[i, 9]; everyDataAndNews.JiangSu = datas[i, 10]; everyDataAndNews.BeiJing = datas[i, 11]; everyDataAndNews.FuJian = datas[i, 12]; everyDataAndNews.ShangHai = datas[i, 13]; everyDataAndNews.GuangXi = datas[i, 14]; everyDataAndNews.HeBei = datas[i, 15]; everyDataAndNews.Sanxi = datas[i, 16]; everyDataAndNews.YunNan = datas[i, 17]; everyDataAndNews.HaiNan = datas[i, 18]; everyDataAndNews.HeiLongJiang = datas[i, 19]; everyDataAndNews.LiaoNing = datas[i, 20]; everyDataAndNews.ShanXi = datas[i, 21]; everyDataAndNews.TianJin = datas[i, 22]; everyDataAndNews.GanSu = datas[i, 23]; everyDataAndNews.NeiMengGu = datas[i, 24]; everyDataAndNews.XinJiang = datas[i, 25]; everyDataAndNews.NingXia = datas[i, 26]; everyDataAndNews.JiLin = datas[i, 27]; everyDataAndNews.GuiZhou = datas[i, 28]; everyDataAndNews.QingHai = datas[i, 29]; everyDataAndNews.XiZang = datas[i, 30]; everyDataAndNews.AoMen = datas[i, 31]; everyDataAndNews.XiangGang = datas[i, 32]; everyDataAndNews.TaiWan = datas[i, 33]; platformContext.EveryDataAndNewes.Add(everyDataAndNews); } platformContext.SaveChanges(); }
public ActionResult Index(ContactViewModel msg) { Contact contact = new Contact(); if (ModelState.IsValid) { contact.Content = msg.Message; int idUser = Convert.ToInt32(Session["EnterID"]); contact.User = db.Users.Find(idUser); ViewBag.Warning = "Mesajınız gönderildi, teşekkürler :)"; db.Contacts.Add(contact); db.SaveChanges(); } return(View()); }
public T Add(T entity) { _context.Set <T>().Add(entity); _context.SaveChanges(); return(entity); }
public void AddNeed(Need need) { platformContext.Needs.Add(need); platformContext.SaveChanges(); }