public bool Add(T entity)
        {
            DbSet <T> dbSet = this.context.Set <T>();

            dbSet.Add(entity);
            int i = context.SaveChanges();

            return(i > 0);
        }
Exemple #2
0
        public ActionResult Create([Bind(Include = "CourseID,VetNationalCode,CourseName,CourseComment")] Course course)
        {
            if (ModelState.IsValid)
            {
                db.Courses.Add(course);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(course));
        }
Exemple #3
0
        public ActionResult Create([Bind(Include = "FirstMidName,LastName,ContactNumber,EmailAddress,FullName")] AgentRepresentative agentRepresentative)
        {
            if (ModelState.IsValid)
            {
                db.AgentRepresentatives.Add(agentRepresentative);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(View(agentRepresentative));
        }
Exemple #4
0
        public ActionResult Create([Bind(Include = "StaffID,FirstMidname,LastName")] Staff staff)
        {
            if (ModelState.IsValid)
            {
                db.Staffs.Add(staff);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(View(staff));
        }
Exemple #5
0
        public ActionResult Create([Bind(Include = "PricingID,CourseID,CourseType,TuitionFee,MaterialFee,ApplicationFee,PricingComment")] Pricing pricing)
        {
            if (ModelState.IsValid)
            {
                db.Pricings.Add(pricing);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CourseID = new SelectList(db.Courses, "CourseID", "VetNationalCode", pricing.CourseID);
            return(View(pricing));
        }
Exemple #6
0
        public ActionResult Create([Bind(Include = "AgentID,LegalName,TradingName,EmailAddress,ContactNumber,ContactPerson," +
                                                   "AgentApplicationForm,CompanyRegistration,Agreement,AgreementSignedDate,CompanyProfile,ReportedToAsqa,AgentRepresentativeID,StaffID")] Agent agent)
        {
            if (ModelState.IsValid)
            {
                db.Agents.Add(agent);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }

            PopulateAgentRepresentativeDropDown();
            PopulateStaffDropDown();
            return(View(agent));
        }
 public void Init()
 {
     using var context = new AmsContext(Options);
     context.StatusMapEvents.Add(new StatusMapEvent
     {
         StatusMap = new StatusMap(),
         Event     = new Event(),
     });
     context.SaveChanges();
 }
Exemple #8
0
 public bool SaveAccomodationType(AccomodationType accomodation)
 {
     context.accomodationTypes.Add(accomodation);
     return(context.SaveChanges() > 0);
 }
 public bool SaveAccomodation(Accomodation accomodations)
 {
     context.accomodation.Add(accomodations);
     return(context.SaveChanges() > 0);
 }
 public bool SaveAccomodationPackage(AccomodationPackage accomodationpackage)
 {
     context.accomodationPackages.Add(accomodationpackage);
     return(context.SaveChanges() > 0);
 }