Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Produces("application/json")]
- [Route("api/Audit")]
- public class AuditController : Controller
- {
- private IConfiguration _configuration;
- private CommomUtility util;
- private Login Login;
- public AuditController(IConfiguration configuration)
- {
- _configuration = configuration;
- util = new CommomUtility(configuration);
- Login = new Login(configuration);
- }
- [HttpPost]
- public JsonResult Action([FromBody] List<Dictionary<string, string>> li)
- {
- DataTable dt = new DataTable();
- string jsonString = string.Empty;
- try
- {
- if (li[0]["ActionMethod"].Equals("CheckLogin", StringComparison.InvariantCultureIgnoreCase))
- {
- dt = Login.checkLogin(li);
- }
- }
- catch (Exception ex)
- {
- }
- finally
- {
- dt.TableName = "Result";
- jsonString = util.DataTableToJson(dt);
- }
- return Json(JObject.Parse(jsonString));
- }
- }
- import { Component, OnInit } from '@angular/core';
- import { HttpClient,HttpClientModule,HttpParams } from '@angular/common/http';
- @Component({
- selector: 'app-login',
- templateUrl: './login.component.html',
- styleUrls: ['./login.component.css']
- })
- export class LoginComponent implements OnInit {
- username: string="";
- password: string="";
- loginBtnText: string='Log In';
- clearBtnText: string='Reset Fields';
- message:string;
- cssClass:string;
- constructor(private http:HttpClient ) { }
- ngOnInit() {
- }
- checkLogIn(){
- const params = new HttpParams();
- params.set('ActionMethod', 'CheckLogin');
- params.set('StaffCode', '15989');
- params.set('Password', 'a$a#');
- debugger
- var v= this.http.post("http://localhost:57863/api/Audit/",
- params,
- )
- .subscribe(data =>
- {alert('ok');},
- error =>
- {alert("Error");}
- );
- }
- clearFields(){
- this.username="";
- this.password="";
- this.message="";
- }
- }
Add Comment
Please, Sign In to add comment