public clsstatuscode ForgotPassword(string username) { User u = db.Users.Where(l => l.username == username).FirstOrDefault(); if (u != null) { int OTP = RandomPassword(); db.Users.Where(l => l.username == username).FirstOrDefault().TempOTP = OTP; db.SaveChanges(); string smsmsg; smsmsg = "Dear " + u.userEmail + " , Your OTP to change Password for https://TollPay.IN is -. -" + OTP; ns.sendsms("smsfrom", u.username, smsmsg); // ns.sendemail(u.userEmail, "", "TollPay.IN OTP To Reset Password", smsmsg); clsstatuscode cs = new clsstatuscode(); cs.statuscode = 000; cs.statusdesc = "OTP Send to Registered Mobile No - XXXXX" + u.username.Substring(u.username.Length - 4); return(cs); } else { clslststatuscode css = new clslststatuscode(); clsstatuscode scd = css.getstatuscodes().Where(s => s.statuscode == 020).FirstOrDefault(); return(scd); } }
public IHttpActionResult PostUser(User user) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } User vuser = db.Users.Where(u => u.username == user.username).FirstOrDefault(); if (vuser == null) { db.Users.Add(user); db.SaveChanges(); string smsmsg; smsmsg = "Dear Customer, Login to Web 'https://TollPay.IN' with UserName="******", Password="******"smsfrom", user.mobno1, smsmsg); ns.sendemail(user.userEmail, "", "Welcome to TollPay.IN", smsmsg); return(CreatedAtRoute("DefaultApi", new { id = user.srno }, user)); } else { clslststatuscode css = new clslststatuscode(); clsstatuscode scd = css.getstatuscodes().Where(s => s.statuscode == 019).FirstOrDefault(); return(CreatedAtRoute("DefaultApi", new { id = user.srno }, scd)); } }
public HttpResponseMessage DistributorToSalesPersonFastTags(HttpRequestMessage request, DistributorToSalesPersonTags[] dtspt) { clslststatuscode css = new clslststatuscode(); clsstatuscode scd = css.getstatuscodes().Where(s => s.statuscode == 001).FirstOrDefault(); if (dtspt == null) { return(request.CreateResponse(HttpStatusCode.BadRequest, scd)); } try { foreach (var item in dtspt) { if (!string.IsNullOrEmpty(item.TagNo)) { int DId = Convert.ToInt32(item.DistributorUserID); int SId = Convert.ToInt32(item.SalesUserID); db.ecom_RFID.Where(ec => ec.Serial_Number == item.TagNo && ec.ecom_DistributionID == DId).FirstOrDefault().ecom_DistributionID = SId; db.ecom_RFID.Where(ec => ec.Serial_Number == item.TagNo && ec.ecom_DistributionID == DId).FirstOrDefault().ecom_CreatedDate = DateTime.Now; db.SaveChanges(); //update inward table IndusInd_TagStockDetails iits = db.IndusInd_TagStockDetails.Where(x => x.Serial_Number == item.TagNo).FirstOrDefault(); iits.SalesPerson_Id = SId; iits.SalesPerson_Assign_Date = DateTime.Now; db.SaveChanges(); } } } catch (Exception ex) { return(request.CreateResponse(HttpStatusCode.InternalServerError, scd)); } scd = css.getstatuscodes().Where(s => s.statuscode == 000).FirstOrDefault(); return(request.CreateResponse(HttpStatusCode.OK, scd)); }