public ActionResult Create([Bind(Include = "Id,Poid,Introduction,Details")] Products products, HttpPostedFileBase[] files) { if (ModelState.IsValid) { // products.Poid =Convert.ToInt32( TempData["OwnerId"]); db.Productses.Add(products); db.SaveChanges(); if (files != null) { UploadImages ui = new UploadImages(); foreach (HttpPostedFileBase file in files) { string filename = System.IO.Path.GetFileName(file.FileName); file.SaveAs(Server.MapPath("~/Images/" + filename)); ui.ImageName = filename; ui.ProductId = products.Id; db.UploadImageses.Add(ui); db.SaveChanges(); } // db.SaveChanges(); ViewBag.Message = "File Uploaded successfully."; } return(RedirectToAction("Index")); } // ViewBag.Poid = new SelectList(db.ProductOwners, "Id", "CompanyName", products.Poid); return(View(products)); }
public IHttpActionResult PutProductOwner(int id, ProductOwner productOwner) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != productOwner.Id) { return(BadRequest()); } db.Entry(productOwner).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ProductOwnerExists(id)) { return(NotFound()); } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Create([Bind(Include = "Id,CompanyName,EmailId,Description,DateofJoin,FoundedIn,Street1,Street2,City,State,Country,Pincode,ContactNumber,Website,Twitter,Facebook,Password,ApprovalFlag")] ProductOwner productOwner) { if (ModelState.IsValid) { db.ProductOwners.Add(productOwner); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(productOwner)); }
public IHttpActionResult PostProducts(ProductsList productsList) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var userid = User.Identity.GetUserId(); var followProducts = new FollowProducts(); followProducts.Euid = Convert.ToInt32(userid); followProducts.MProductId = productsList.Id; Db.FollowProducts.Add(followProducts); Db.SaveChanges(); return(Ok()); }
public ActionResult Create(EndUser endUser) { if (ModelState.IsValid) { endUser.UserId = Convert.ToInt32(TempData["UserId"]); db.EndUsers.Add(endUser); db.SaveChanges(); return(RedirectToAction("Index", "MyFollow")); } return(View(endUser)); }
public ActionResult Edit(ProductOwner productOwner) { if (ModelState.IsValid) { productOwner.EmailId = Session["Email"].ToString(); db.Entry(productOwner).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Details", new { Email = Session["Email"] })); } return(View(productOwner)); }
public ActionResult Create(ProductOwner productOwner) { if (ModelState.IsValid) { productOwner.UserId = Convert.ToInt32(TempData["UserId"]); db.ProductOwners.Add(productOwner); db.SaveChanges(); TempData["UserId"] = ""; return(RedirectToAction("Index", "MyFollow")); } return(View(productOwner)); }
public ActionResult Create(MyFollow myFollow) { if (ModelState.IsValid) { db.MyFollows.Add(myFollow); db.SaveChanges(); TempData["UserId"] = myFollow.UserId; if (myFollow.Role == "Product Owner") { return(RedirectToAction("Create", "ProductOwner")); } else { return(RedirectToAction("Create", "EndUser")); } } return(View(myFollow)); }