public HttpResponseMessage CreateEmployee([FromBody] EmployeeModel objEmployee) { //token from user var token = objEmployee.token; //checking Token var result = Authtoken.checkToken(token); if (result == true) { var Mobileexist = Authtoken.checkmobile(objEmployee.mobile); if (Mobileexist == false) { //----------------------------------------------------------------------------- // |> Inserting Employee Details <| //------------------------------------------------------------------------------- dt = objemployeeDL.getEmployescount(); objEmployee.pin = Authtoken.GeneratePin(); objEmployee.mobile = objEmployee.mobile; objEmployee.token = Authtoken.genarateToken(); objEmployee.userId = Authtoken.genarateUserId(); //objEmployee.empId = Convert.ToInt16(dt.Rows[0]["empcount"].ToString())+1; objEmployee.usertype = "employee"; //objemployeeDL.insert_loginDetails(objloginModel); //------------------------------------------------------------------------------- // |> Inserting Login Details <| //------------------------------------------------------------------------------- objEmployee.useridfk = Authtoken.usercount() + 1; objemployeeDL.insert_EmployeeDetails(objEmployee); var resp = Request.CreateResponse <ResponseModel>(HttpStatusCode.OK, new ResponseModel() { message = "Employee created sucessfully", statuscode = Convert.ToInt16(HttpStatusCode.OK) }); return(resp); } else { var resp = Request.CreateResponse <ResponseModel>(HttpStatusCode.OK, new ResponseModel() { message = "Already This Mobile no Registered", statuscode = Convert.ToInt16(HttpStatusCode.OK) } ); return(resp); } } else { var resp = Request.CreateResponse <ResponseModel>(HttpStatusCode.OK, new ResponseModel() { message = "UnAuthorized", statuscode = Convert.ToInt16(HttpStatusCode.OK), error = true }); return(resp); } }
public HttpResponseMessage registerDriver([FromBody] DriverModel driverm) { // token from user var token = driverm.token; //checking Token var result = Authtoken.checkToken(token); if (result == true) { var Mobileexist = Authtoken.checkmobile(driverm.mobile); if (Mobileexist == false) { /*--------------------------------------------------------------------------- * Inserting Login Details * -------------------------------------------------------------------------- */ dt = objDriverDl.getDriverscount(); objloginModel.mobile = driverm.mobile; objloginModel.pin = driverm.pin; objloginModel.token = Authtoken.genarateToken(); objloginModel.userId = Authtoken.genarateUserId(); objloginModel.driverId = Convert.ToInt16(dt.Rows[0]["drivercount"].ToString()) + 1;; objloginModel.userType = "driver"; objDriverDl.insert_loginDetails(objloginModel); /*--------------------------------------------------------------- * Insert Drivers Details *--------------------------------------------------------------- */ driverm.userid = Authtoken.usercount() + 1; objDriverDl.insert_DriverDetails(driverm); var resp = Request.CreateResponse <ResponseModel>(HttpStatusCode.OK, new ResponseModel() { message = "Driver Register Succesfully", statuscode = Convert.ToInt16(HttpStatusCode.OK) } ); return(resp); } else { var resp = Request.CreateResponse <ResponseModel>(HttpStatusCode.OK, new ResponseModel() { message = "Already This Mobileno Registered", statuscode = Convert.ToInt16(HttpStatusCode.OK) } ); return(resp); } } else { var resp = Request.CreateResponse <ResponseModel>(HttpStatusCode.OK, new ResponseModel() { message = "no token", statuscode = Convert.ToInt16(HttpStatusCode.NoContent) }); return(resp); } }