Exemplo n.º 1
0
        public IHttpActionResult Form([FromBody] AdmissionForm admissionForm)
        {
            var res = new ApiResponse();

            try
            {
                Random r       = new Random();
                int    num     = r.Next();
                var    student = new StudentAdmissionForm()
                {
                    Address            = admissionForm.address,
                    CandidateName      = admissionForm.candidatename,
                    City               = admissionForm.city,
                    Email              = admissionForm.email,
                    FatherName         = admissionForm.fathername,
                    Mobile             = admissionForm.mobile,
                    MotherName         = admissionForm.mothername,
                    State              = admissionForm.state,
                    CourseType         = admissionForm.coursetype,
                    RegistrationNumber = num
                };
                var response = _admissionForm.Add(student);


                var lstmap = admissionForm.items.ConvertAll(x => new StudentQualificationMapping
                {
                    Boards             = x.boards,
                    Class              = x.sclass,
                    StudentAdmissionID = response.Id,
                    Subjects           = x.subjects,
                    YearOfPassing      = x.yearofpassing,
                }).ToList();
                var returrep = _studentMapping.BulkAdd(lstmap);

                res = new ApiResponse()
                {
                    status = HttpStatusCode.OK.ToString(),
                    code   = (int)HttpStatusCode.OK,
                    result = lstmap
                };
            }
            catch (Exception ex)
            {
                throw;
            }


            return(Ok(res));
        }