Exemple #1
0
        public async Task <HttpResponseMessage> Post(StudentCreateItem studentItem)
        {
            var student = Mapper.Map <Student>(studentItem);

            await this.repository.Save(student);

            return(this.Request.CreateResponse(HttpStatusCode.OK));
        }
        public async Task <HttpResponseMessage> Update(StudentCreateItem student)
        {
            try
            {
                await this.repositoryService.Update(student);
            }
            catch
            {
                this.ModelState.AddModelError("Exception", "Student update failed. Please contact to your system admin.");
                return(this.Request.CreateErrorResponse(HttpStatusCode.OK, this.ModelState));
            }

            return(this.Request.CreateResponse(HttpStatusCode.OK));
        }
Exemple #3
0
        public async Task <HttpResponseMessage> Post(StudentCreateItem student)
        {
            await this.repositoryService.Save(student);

            return(this.Request.CreateResponse(HttpStatusCode.OK));
        }
Exemple #4
0
 public HttpResponseMessage Post(StudentCreateItem student)
 {
     this.studentService.Save(student);
     return(this.Request.CreateResponse(HttpStatusCode.OK));
 }