예제 #1
0
        public IHttpActionResult PutOrderTable(int id, OrderTable orderTable)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != orderTable.OrderId)
            {
                return(BadRequest());
            }

            db.Entry(orderTable).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OrderTableExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #2
0
        public void getCourse()
        {
            baseCrawler.GotoMainPage();

            baseCrawler.LoginPage();


            Guid univid = Guid.Parse("dbac5470-14db-4492-80b0-d8e8d9d85c3e");

            foreach (string key in baseCrawler.CourseList.Keys)
            {
                string coursename = baseCrawler.CourseList[key];
                var    course     = (from crs in db.Courses where crs.CourseName == coursename select crs).FirstOrDefault();

                if (course == null)
                {
                    LMS.Models.Cours cose = new Cours();
                    cose.CourseId          = Guid.NewGuid();
                    cose.CourseName        = baseCrawler.CourseList[key];
                    cose.CourseDescription = baseCrawler.CourseList[key];
                    cose.CourseCreateDate  = DateTime.Now;

                    db.Courses.Add(cose);

                    LMS.Models.CourseUniversity courseUnv = new CourseUniversity();
                    courseUnv.UniversityId = univid;
                    courseUnv.CourseId     = cose.CourseId;
                    courseUnv.Id           = Guid.NewGuid();

                    db.CourseUniversities.Add(courseUnv);

                    db.SaveChanges();
                }
            }
        }
        public IHttpActionResult PutWishlist(int id, Wishlist wishlist)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != wishlist.WishListId)
            {
                return(BadRequest());
            }

            db.Entry(wishlist).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!WishlistExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult DeleteStudentConfirmed(int id)
        {
            Student user = db.Students.Find(id);

            db.Students.Remove(user);
            db.SaveChanges();
            return(RedirectToAction("RegistrationList"));
        }
예제 #5
0
 public ActionResult Create([Bind(Include = "CourseId,CourseName,CourseDescription,IsActive")] Course course)
 {
     if (ModelState.IsValid)
     {
         db.Courses.Add(course);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(course));
 }
예제 #6
0
        public ActionResult Create([Bind(Include = "EmpId,FirstName,LastName")] EmpDetail empDetail)
        {
            if (ModelState.IsValid)
            {
                db.EmpDetails.Add(empDetail);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(empDetail));
        }
        public ActionResult Create([Bind(Include = "Role_Id,Role_Name,Descriptions")] Role role)
        {
            if (ModelState.IsValid)
            {
                db.Roles.Add(role);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(role));
        }
        public ActionResult Create([Bind(Include = "Author_Id,Author_Name,Author_Description")] Author author)
        {
            if (ModelState.IsValid)
            {
                db.Authors.Add(author);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(author));
        }
예제 #9
0
        public ActionResult Create([Bind(Include = "BookID,ISBN,Title,DateofPublication")] Book book)
        {
            if (ModelState.IsValid)
            {
                db.Books.Add(book);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(book));
        }
예제 #10
0
        public ActionResult Create([Bind(Include = "JobID,JobName")] Job job)
        {
            if (ModelState.IsValid)
            {
                db.Jobs.Add(job);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(job));
        }
예제 #11
0
        public ActionResult Create([Bind(Include = "Category_Id,Category_Name,Category_Description")] category category)
        {
            if (ModelState.IsValid)
            {
                db.categories.Add(category);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(category));
        }
예제 #12
0
        public ActionResult Create([Bind(Include = "UserID,FirstName,LastName,UserName,Email,Phone")] LibUser libUser)
        {
            if (ModelState.IsValid)
            {
                db.LibUsers.Add(libUser);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(libUser));
        }
예제 #13
0
        public ActionResult Create([Bind(Include = "id,name,password,enrollment,email,contact,address")] Student student)
        {
            if (ModelState.IsValid)
            {
                db.Students.Add(student);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(student));
        }
예제 #14
0
        public ActionResult Create([Bind(Include = "UserID,FirstName,LastName,IsManager,Email,JobID,ReportsToID")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(employee));
        }
예제 #15
0
        public ActionResult Create([Bind(Include = "Staff_Id,First_Name,Last_Name,Phone_No,Email,Username,Pass,Role_Id")] Staff staff)
        {
            if (ModelState.IsValid)
            {
                db.Staffs.Add(staff);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Role_Id = new SelectList(db.Roles, "Role_Id", "Role_Name", staff.Role_Id);
            return(View(staff));
        }
예제 #16
0
        public ActionResult Create([Bind(Include = "Stock_Id,Book_Name,Qty,Available")] stock stock)
        {
            if (ModelState.IsValid)
            {
                db.stocks.Add(stock);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Book_Name = new SelectList(db.Books, "Book_Id", "Book_Name", stock.Book_Name);
            return(View(stock));
        }
예제 #17
0
        public ActionResult Create([Bind(Include = "UserId,FirstName,LastName")] UserDetail userDetail)
        {
            if (ModelState.IsValid)
            {
                db.UserDetails.Add(userDetail);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.UserId = new SelectList(db.AspNetUsers, "Id", "Email", userDetail.UserId);
            return(View(userDetail));
        }
        public ActionResult Create([Bind(Include = "Member_Id,First_Name,Last_Name,Phone_No,Email,User_No,Pass,Role_Id")] Member_Details member_Details)
        {
            if (ModelState.IsValid)
            {
                db.Member_Details.Add(member_Details);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Role_Id = new SelectList(db.Roles, "Role_Id", "Role_Name", member_Details.Role_Id);
            return(View(member_Details));
        }
예제 #19
0
        public ActionResult Create([Bind(Include = "UserID,FirstName,LastName,JobID,ManagerID,Email")] Manager manager)
        {
            if (ModelState.IsValid)
            {
                db.Managers.Add(manager);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.UserID = new SelectList(db.AspNetUsers, "Id", "Email", manager.UserID);
            return(View(manager));
        }
예제 #20
0
        public ActionResult SaveRules(AutoResponderModel objRules)
        {
            var autoResponsder = new AutoRespondingRule();

            autoResponsder.ConditionType = objRules.ConditionType;
            autoResponsder.MatchingText  = objRules.MatchingText;
            autoResponsder.TextType      = objRules.TextType;

            db.AutoRespondingRules.Add(autoResponsder);
            db.SaveChanges();

            return(Json(autoResponsder.id, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Create([Bind(Include = "Book_Id,Book_Name,Category_Id,Author_Id,Publication_Year")] Book book)
        {
            if (ModelState.IsValid)
            {
                db.Books.Add(book);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Author_Id   = new SelectList(db.Authors, "Author_Id", "Author_Name", book.Author_Id);
            ViewBag.Category_Id = new SelectList(db.categories, "Category_Id", "Category_Name", book.Category_Id);
            return(View(book));
        }
예제 #22
0
        public ActionResult Create([Bind(Include = "EntryId,UserEntryId,MetalType,PlaceOfPurchase,DateOfPurchase,AmountOfPurchase")] Entry entry)
        {
            if (ModelState.IsValid)
            {
                db.Entries.Add(entry);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.MetalType   = new SelectList(db.Metals, "MetalId", "Metal_Name", entry.MetalType);
            ViewBag.UserEntryId = new SelectList(db.UserDetails, "UserId", "FirstName", entry.UserEntryId);
            return(View(entry));
        }
예제 #23
0
        public ActionResult Create([Bind(Include = "LessonViewId,EmpId,LessonId,DateViewed")] LessonView lessonView)
        {
            if (ModelState.IsValid)
            {
                db.LessonViews.Add(lessonView);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EmpId    = new SelectList(db.EmpDetails, "EmpId", "FirstName", lessonView.EmpId);
            ViewBag.LessonId = new SelectList(db.Lessons, "LessonId", "LessonTitle", lessonView.LessonId);
            return(View(lessonView));
        }
예제 #24
0
        public ActionResult Create([Bind(Include = "Borrower_Id,Book_Id,Borrower_From,Borrower_To,Issue_By")] Borrower_Details borrower_Details)
        {
            if (ModelState.IsValid)
            {
                db.Borrower_Details.Add(borrower_Details);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Book_Id  = new SelectList(db.Books, "Book_Id", "Book_Name", borrower_Details.Book_Id);
            ViewBag.Issue_By = new SelectList(db.Staffs, "Staff_Id", "First_Name", borrower_Details.Issue_By);
            return(View(borrower_Details));
        }
예제 #25
0
        public ActionResult Create([Bind(Include = "OnLoanID,UserID,BookID,DateIssued,DateDueForReturn,ActualDateReturned")] BookOnLoan bookOnLoan)
        {
            if (ModelState.IsValid)
            {
                db.BookOnLoans.Add(bookOnLoan);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.BookID = new SelectList(db.Books, "BookID", "ISBN", bookOnLoan.BookID);
            ViewBag.UserID = new SelectList(db.LibUsers, "UserID", "FirstName", bookOnLoan.UserID);
            return(View(bookOnLoan));
        }
        public ActionResult Create([Bind(Include = "CourseCompletionID,UserID,CourseID,DateCompleted")] CourseCompletion courseCompletion)
        {
            if (ModelState.IsValid)
            {
                db.CourseCompletions.Add(courseCompletion);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CourseID = new SelectList(db.Courses, "CourseID", "CourseName", courseCompletion.CourseID);
            ViewBag.UserID   = new SelectList(db.UserDetails, "UserID", "FirstName", courseCompletion.UserID);
            return(View(courseCompletion));
        }
예제 #27
0
        public ActionResult Create(ProdiverUnviersityModel universityviewmodel)
        {
            University university = new University();

            if (ModelState.IsValid)
            {
                university = (from unv in
                              db.Universities
                              where unv.UniversityId == universityviewmodel.UniversityId
                              select unv).FirstOrDefault();
                if (universityviewmodel.UniversityId != new Guid())
                {
                    university.UniversityName = universityviewmodel.UniversityName;
                    universityviewmodel.UniversityDescription = universityviewmodel.UniversityDescription;
                    db.Entry(university).State = EntityState.Modified;
                }
                else
                {
                    university = new University();
                    university.UniversityId          = Guid.NewGuid();
                    university.UniversityName        = universityviewmodel.UniversityName;
                    university.UniversityDescription = universityviewmodel.UniversityDescription;
                    db.Universities.Add(university);
                }

                var CUS = db.CourseUniversityLMS.Where(ee => ee.UniversityId == university.UniversityId).ToList();
                if (CUS != null && CUS.Any())
                {
                    db.CourseUniversityLMS.RemoveRange(CUS);
                }

                if (university.UniversityId != null && universityviewmodel.ProviderId.Any())
                {
                    foreach (var item in universityviewmodel.ProviderId)
                    {
                        db.CourseUniversityLMS.Add(new CourseUniversityLM()
                        {
                            ProviderId   = item ?? Guid.Empty,
                            UniversityId = university.UniversityId
                        });
                    }
                }

                UpdateViewBag(university.UniversityId);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(universityviewmodel));
        }
예제 #28
0
        public JsonResult UpdateFaq(Guid FaqId, string FaqAnswer)
        {
            var faq = (from fq in db.FAQs where fq.FAQId == FaqId select fq).FirstOrDefault();

            if (faq != null)
            {
                faq.Answer = FaqAnswer;
            }
            db.SaveChanges();

            string serializedstring = JsonConvert.SerializeObject("Question Updated Successfully");


            return(Json(serializedstring));
        }
예제 #29
0
        public ActionResult AddTeacher(tbl_teacher t, Email e)
        {
            try
            {
                LMSEntities DB      = new LMSEntities();
                Teacher     teacher = new Teacher();
                teacher.Name        = t.Name;
                teacher.Email       = t.Email;
                e.Email1            = t.Email;
                teacher.Designation = t.Designation;


                DB.tbl_teacher.Add(t);
                DB.Emails.Add(e);

                DB.SaveChanges();



                return(RedirectToAction("Teacher"));
            }
            catch
            {
                return(View());
            }
        }
예제 #30
0
        public ActionResult AddAllBooks(All_Books b)
        {
            try
            {
                using (LMSEntities db = new LMSEntities())
                {
                    AllBooks bk = new AllBooks();
                    bk.Name    = b.Name;
                    bk.Number  = b.Number;
                    bk.Price   = b.Price;
                    bk.Author  = b.Author;
                    bk.Edition = b.Edition;
                    bk.Status  = b.Status;

                    db.All_Books.Add(b);
                    db.SaveChanges();
                }


                return(RedirectToAction("AllBooks"));
            }
            catch
            {
                return(View());
            }
        }