Created
June 6, 2019 13:45
-
-
Save Atefnouri/d5dc127a7b0b29f2dbd70dc61b141c94 to your computer and use it in GitHub Desktop.
Tommorw Taks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BackEnd [ | |
1 - Change Concour Type to nVarchar(5) | |
2 - add get by cat method | |
//Get_Concour_By_Type | |
[Route("api/Concours/getByType/{_type}")] | |
[HttpGet()] | |
public IHttpActionResult getConcourbyType(string _type) | |
{ | |
var concours = db.Concour.Where(c => c.Type == _type); | |
if (concours == null) | |
{ | |
return NotFound(); | |
} | |
return Ok(concours); | |
} | |
3- add get om,qm,mat Methods | |
//Get_Concour_OM | |
[Route("api/Concours/Om/{_id}")] | |
[HttpGet()] | |
public IHttpActionResult getConcourOm(int _id) | |
{ | |
var concours = db.Concour.Where(c => c.ConcourID == _id) | |
.Select(c => new | |
{ | |
c.ConcourID, | |
om = c.Om.Count | |
}); | |
return Ok(concours); | |
} | |
//Get_Concour_QM | |
[Route("api/Concours/Qm/{_id}")] | |
[HttpGet()] | |
public IHttpActionResult getConcourQm(int _id) | |
{ | |
var concours = db.Concour.Where(c => c.ConcourID == _id) | |
.Select(c => new | |
{ | |
c.ConcourID, | |
qm = c.Qm.Count | |
}); | |
return Ok(concours); | |
} | |
//Get_Concour_MAT | |
[Route("api/Concours/Mat/{_id}")] | |
[HttpGet()] | |
public IHttpActionResult getConcourMat(int _id) | |
{ | |
var concours = db.Concour.Where(c => c.ConcourID == _id) | |
.Select(c => new | |
{ | |
c.ConcourID, | |
mat = c.Mat.Count | |
}); | |
return Ok(concours); | |
} | |
] | |
4- Front-END [ | |
1- add concour type list add | |
<div class="row"> | |
<div class="col-md-6"> | |
<div class="form-group"> | |
<label for=""> </label> | |
<select class="form-control" name="cat" [(ngModel)]='cat' required> | |
<option value="om" ></option> | |
<option value="qm"></option> | |
<option value="mat"></option> | |
</select> | |
</div> | |
</div> | |
</div> | |
2 - Add Tabs to the Concour List Page | |
/*---get all Concour Form DB--*/ | |
public getConcoursByCat(cat: string): Observable<any>{ | |
return this.http.get(this.proxy.URL_LOCAL + '/api/Concours/getByType/'+ cat) | |
.pipe(map(reponse => reponse.json())); | |
} | |
// Load QmList | |
public loadQmConcours = () => { | |
this.concourService.getConcoursByCat('qm') .subscribe( | |
data => { | |
this.concoursQm = data; | |
}, | |
err => { | |
console.log(err); | |
}, | |
() => { | |
this.loading = false; | |
} | |
); | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment