Exemple #1
0
        public async Task <IHttpActionResult> PutApprovedCourse(string id, ApprovedCourse approvedCourse)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ApprovedCourseExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IHttpActionResult> PutProject(string id, Project project)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != project.uuid)
            {
                return(BadRequest());
            }

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProjectExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <ActionResult> Create([Bind(Include = "id,name")] Location location)
        {
            if (ModelState.IsValid)
            {
                db.locations.Add(location);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(location));
        }
        public async Task <ActionResult> Create([Bind(Include = "id,name")] JobType jobType)
        {
            if (ModelState.IsValid)
            {
                db.jobTypes.Add(jobType);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(jobType));
        }
Exemple #5
0
        public async Task <ActionResult> Create([Bind(Include = "id,name,position,phone,email")] Contact contact)
        {
            if (ModelState.IsValid)
            {
                db.contacts.Add(contact);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(contact));
        }
        public async Task <ActionResult> Create([Bind(Include = "id,token,deviceType")] Device device)
        {
            if (ModelState.IsValid)
            {
                db.devices.Add(device);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(device));
        }
        public async Task <ActionResult> Create([Bind(Include = "username,name,email")] Student student)
        {
            if (ModelState.IsValid)
            {
                db.students.Add(student);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(student));
        }
Exemple #8
0
        public async Task <ActionResult> Create([Bind(Include = "uuid,title,description,webpage,linkedInProfile,expiryDate,stepsToApply,created,published,modified")] Job job)
        {
            if (ModelState.IsValid)
            {
                db.jobs.Add(job);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(job));
        }
        public async Task <ActionResult> Create([Bind(Include = "id,name")] StudyGroup studyGroup)
        {
            if (ModelState.IsValid)
            {
                db.studyGroup.Add(studyGroup);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(studyGroup));
        }