コード例 #1
0
        public HttpResponseMessage Get(int id, int year)
        {
            // var years = this.getYearsQuery.QueryAll();
            var pdf = new GenerateParamedicalFeeReceiptQuery();
            GetStudentFeeDetailsQuery query = new GetStudentFeeDetailsQuery();
            var fees = query.ExecuteQueryWith(id);

            if (fees == null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "No Fee receipt found for the requested student. Check student id and try again."));
            }
            var fee = fees.FirstOrDefault(p => p.Year == year);

            if (fee == null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "No Fee receipt found for the requested year. Check your inputs and try again."));
            }
            GetStudentQuery squery  = new GetStudentQuery();
            var             student = squery.ExecuteQueryWith(id.ToString());

            fee.Name       = student.Name;
            fee.BranchName = student.BranchName;
            fee.FatherName = student.FatherName;

            var ms = pdf.ExecuteQueryWith(fee);

            HttpResponse Response = HttpContext.Current.Response;

            Response.ContentType = "pdf/application";
            Response.AddHeader("content-disposition", "attachment;filename=FeeReceipt_" + id + ".pdf");
            Response.OutputStream.Write(ms.GetBuffer(), 0, ms.GetBuffer().Length);

            return(Request.CreateResponse(HttpStatusCode.OK));
        }
コード例 #2
0
        public async Task <IActionResult> Get(int id)
        {
            var query = new GetStudentQuery()
            {
                Id = id
            };

            return(Ok(await mediator.Send(query)));
        }
コード例 #3
0
ファイル: StudentController.cs プロジェクト: rsuharta/DDD
        public async Task <IActionResult> Get(string studentNumber, CancellationToken cancellationToken)
        {
            var query = new GetStudentQuery {
                StudentNumber = studentNumber
            };
            var dto = await this.mediator.Send(query, cancellationToken);

            return(this.Ok(dto));
        }