public void InsertTrainees(Models.UserDetail User) { DBcontext.UserDetails.Add(User); DBcontext.SaveChanges(); }
public IHttpActionResult Putgame(int id, game game) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != game.game_id) { return(BadRequest()); } db.Entry(game).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!gameExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutBookingTable(int id, BookingTable bookingTable) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bookingTable.Ticket_Id) { return(BadRequest()); } db.Entry(bookingTable).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BookingTableExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutAspNetUser(string id, AspNetUser aspNetUser) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != aspNetUser.Id) { return(BadRequest()); } db.Entry(aspNetUser).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AspNetUserExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutRating(int id, Rating rating) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != rating.ProductID) { return(BadRequest()); } db.Entry(rating).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!RatingExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
private void AddRadnik() { Random random = new Random(); Majstor radnik = new Majstor(); radnik.Radnik = new Radnik(); radnik.Radnik.Ime = Ime; radnik.Radnik.Prezime = Prezime; radnik.Radnik.MBR = MBR; radnik.Radnik.Sifra_radnika = random.Next(0, 100); string[] speci = Specijalnost.Split(' '); radnik.Specijalnost = speci[1]; radnik.Radnik.Majstor = ""; entities.Majstors.Add(radnik); entities.SaveChanges(); foreach (Majstor m in entities.Majstors) { RadnikList.Add(m); } Ime = string.Empty; Prezime = string.Empty; MBR = string.Empty; Specijalnost = string.Empty; }
public IHttpActionResult PutComment(int id, Comment comment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != comment.ID) { return(BadRequest()); } db.Entry(comment).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CommentExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Create([Bind(Include = "attractionId,address,attractionName")] attraction attraction) { if (ModelState.IsValid) { db.attraction.Add(attraction); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(attraction)); }
public ActionResult Create([Bind(Include = "Id,Name")] AspNetRoles aspNetRoles) { if (ModelState.IsValid) { db.AspNetRoles.Add(aspNetRoles); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(aspNetRoles)); }
public ActionResult Create([Bind(Include = "Id,Email,EmailConfirmed,PasswordHash,SecurityStamp,PhoneNumber,PhoneNumberConfirmed,TwoFactorEnabled,LockoutEndDateUtc,LockoutEnabled,AccessFailedCount,UserName")] AspNetUsers aspNetUsers) { if (ModelState.IsValid) { db.AspNetUsers.Add(aspNetUsers); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(aspNetUsers)); }
public ActionResult Create([Bind(Include = "EQUIPMENT_ID,EQUIPMENT_NAME,QUANTITY")] EQUIPMENT eQUIPMENT) { if (ModelState.IsValid) { db.EQUIPMENTS.Add(eQUIPMENT); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(eQUIPMENT)); }
public ActionResult Create([Bind(Include = "ROOM_ID,ROOM_NAME")] ROOM rOOM) { if (ModelState.IsValid) { db.ROOMS.Add(rOOM); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(rOOM)); }
public ActionResult Create([Bind(Include = "id,Title,Discription,ImageUrl,Quantity,Price")] Product product) { if (ModelState.IsValid) { db.Products.Add(product); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product)); }
public ActionResult Create([Bind(Include = "ACTIVITY_ID,NAME,PERIOD")] ACTIVITy aCTIVITy) { if (ModelState.IsValid) { db.ACTIVITIES.Add(aCTIVITy); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(aCTIVITy)); }
public ActionResult Create([Bind(Include = "guideId,guideName,guidetype,registerDate")] guide guide) { if (ModelState.IsValid) { db.guide.Add(guide); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(guide)); }
public ActionResult Create([Bind(Include = "REF_NO,NAME,ADDRESS,DATE_OF_BIRTH")] CUSTOMER cUSTOMER) { if (ModelState.IsValid) { db.CUSTOMERS.Add(cUSTOMER); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cUSTOMER)); }
public ActionResult Create([Bind(Include = "STAFF_ID,STAFF_NAME,STAFF_DESIGNATION,STAFF_TYPE")] STAFF sTAFF) { if (ModelState.IsValid) { db.STAFFS.Add(sTAFF); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(sTAFF)); }
public ActionResult Create([Bind(Include = "preferenceID,durationDays,attractionName,budget,guideType,generateTime,UID")] userPreference userPreference) { if (ModelState.IsValid) { db.userPreference.Add(userPreference); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UID = new SelectList(db.AspNetUsers, "Id", "Email", userPreference.UID); return(View(userPreference)); }
public ActionResult Create([Bind(Include = "RegionId,Name")] City city) { if (ModelState.IsValid) { db.City.Add(city); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.RegionId = new SelectList(db.Region, "Id", "Name", city.RegionId); return(View(city)); }
public ActionResult Create([Bind(Include = "Id,Name,City,Postalcode")] Customer customer) { if (ModelState.IsValid) { db.Customers.Add(customer); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Id = new SelectList(db.Carts, "id", "id", customer.Id); return(View(customer)); }
public ActionResult Create([Bind(Include = "Id,RootCategoryId,Name")] Category category) { if (ModelState.IsValid) { db.Category.Add(category); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.RootCategoryId = new SelectList(db.Category, "Id", "Name", category.RootCategoryId); return(View(category)); }
public ActionResult Create([Bind(Include = "CustomerID,FirstName,LastName,Phone")] CustomerVM customerVM) { if (ModelState.IsValid) { var customer = CustomerVM.MapTo(customerVM); db.Customers.Add(customer); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customerVM)); }
public ActionResult Create([Bind(Include = "Name")] Region region) { if (ModelState.IsValid) { db.Region.Add(region); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(region)); }
public ActionResult Create([Bind(Include = "UId,PName,PPrice")] Package package) { if (ModelState.IsValid) { db.Packages.Add(package); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UId = new SelectList(db.AspNetUsers, "Id", "Email", package.UId); return(View(package)); }
public ActionResult Create([Bind(Include = "ParkingID,ParkingName,Capacity, Zone")] ParkingLotVM parkingLotVM) { if (ModelState.IsValid) { var parkingLot = ParkingLotVM.MapTo(parkingLotVM); db.ParkingLots.Add(parkingLot); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(parkingLotVM)); }
public ActionResult Create([Bind(Include = "SESSION_CODE,START_TIME,ACTIVITY_ID,ROOM_ID,REF_NO")] SESSION sESSION) { if (ModelState.IsValid) { db.SESSIONS.Add(sESSION); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ACTIVITY_ID = new SelectList(db.ACTIVITIES, "ACTIVITY_ID", "NAME", sESSION.ACTIVITY_ID); ViewBag.REF_NO = new SelectList(db.CUSTOMERS, "REF_NO", "NAME", sESSION.REF_NO); ViewBag.ROOM_ID = new SelectList(db.ROOMS, "ROOM_ID", "ROOM_NAME", sESSION.ROOM_ID); return(View(sESSION)); }
public ActionResult Create([Bind(Include = "Id,UserId,CategoryId,CityId,Visits,IsPremium,IsActive,Pub_Time,Exp_Time,Title,Description")] Advertisment advertisment) { if (ModelState.IsValid) { db.Advertisment.Add(advertisment); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CityId = new SelectList(db.City, "Id", "Name", advertisment.CityId); ViewBag.CategoryId = new SelectList(db.Category, "Id", "Name", advertisment.CategoryId); ViewBag.UserId = new SelectList(db.AspNetUsers, "Id", "Email", advertisment.UserId); return(View(advertisment)); }
public ActionResult Create([Bind(Include = "tourPlanId,attractionDetails,geneateTime,price,calendar,preferenceID,guideId,attractionId")] tourPlan tourPlan) { if (ModelState.IsValid) { db.tourPlan.Add(tourPlan); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.attractionId = new SelectList(db.attraction, "attractionId", "address", tourPlan.attractionId); ViewBag.guideId = new SelectList(db.guide, "guideId", "guideName", tourPlan.guideId); ViewBag.preferenceID = new SelectList(db.userPreference, "preferenceID", "attractionName", tourPlan.preferenceID); return(View(tourPlan)); }
private void AddAlat() { Alat alat = new Alat(); Random rand = new Random(); alat.Naziv_alata = Naziv; alat.Sifra_alata = rand.Next(0, 100); entities.Alats.Add(alat); entities.SaveChanges(); alatList.Add(alat); Naziv = string.Empty; }
public ActionResult Create([Bind(Include = "ReservationID,CustomerID,ParkingID,StartDate,EndDate")] Reservation reservation) { if (ModelState.IsValid) { db.Reservations.Add(reservation); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "FirstName", reservation.CustomerID); ViewBag.ParkingID = new SelectList(db.ParkingLots.GroupBy(x => x.ParkingName).Select(x => x.FirstOrDefault()).ToList(), "ParkingID", "ParkingName"); var reservationsVM = ReservationVM.MapTo(reservation); return(View(reservationsVM)); }
public void Perform(Action execute) { using (var ctx = new Entities2()) { AddToPool(ctx); try { execute(); ctx.SaveChanges(); //No commit if Exception. } finally { RemoveFromPool(); } } }