public HttpResponseMessage AddDateTime([FromBody] ChitDateTime[] TempChitDateTime, string ChitGroup) { try { List <ChitTermGroup> _ChitTermGroupList = new List <ChitTermGroup>(); foreach (var ed in TempChitDateTime) { ChitTermGroup A = new ChitTermGroup(); A.chitid = ChitGroup; A.termgroupid = ChitGroup + "/" + ed.DurationID; A.startdate = ed.StartDate; A.enddate = ed.EndDate; A.termnumber = ed.DurationID; A.createddate = DateTime.Now; A.status = true; _ChitTermGroupList.Add(A); } _db.ChitTermGroups.AddRange(_ChitTermGroupList); _db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "Success")); } catch { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Failed")); } }
public HttpResponseMessage VerifyOTP(string Phonenumber, int OTP) { try { UserRegistration User = _db.UserRegistrations.Where(d => d.phonenumber == Phonenumber && d.randomnnumber == OTP).First(); UserCredential _UserDetails = _db.UserCredentials.Where(d => d.phonenumber == User.phonenumber).FirstOrDefault(); if (_UserDetails == null) { try { UserCredential _NewUser = new UserCredential(); _NewUser.phonenumber = Phonenumber; _NewUser.Updateddate = DateTime.Now; _NewUser.email = "com"; _NewUser.password = "******"; _db.UserCredentials.Add(_NewUser); _db.SaveChanges(); } catch (Exception E) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, E)); } } _UserDetails = _db.UserCredentials.Where(d => d.phonenumber == User.phonenumber).FirstOrDefault(); return(Request.CreateResponse(HttpStatusCode.OK, _UserDetails)); } catch { int _NewRandomNumber = GenerateRandomNo(); var result = _db.UserRegistrations.SingleOrDefault(b => b.phonenumber == Phonenumber); if (result != null) { result.randomnnumber = _NewRandomNumber; _db.SaveChanges(); } return(Request.CreateResponse(HttpStatusCode.OK, _NewRandomNumber)); } }
public HttpResponseMessage AddTransaction([FromBody] AddTransaction AddTransaction) { try { ChitTransaction _NewTransaction = new ChitTransaction(); _NewTransaction.amount = AddTransaction.Amount; _NewTransaction.Chitid = AddTransaction.ChitId; _NewTransaction.userid = AddTransaction.UserId; _NewTransaction.TermGroupId = AddTransaction.TermGroupId; _NewTransaction.modeofpayment = AddTransaction.ModeOfPayment; _NewTransaction.paymentstatus = 1; _NewTransaction.Createddate = DateTime.Now; _db.ChitTransactions.Add(_NewTransaction); _db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "Success")); } catch { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Failed Transaction")); } }
public HttpResponseMessage UpdateProfile([FromBody] P_UserProfile UserProfile) { try { var User = _db.UserCredentials.Where(d => d.userid == UserProfile.UserId).FirstOrDefault(); if (User != null) { User.email = UserProfile.Email; User.phonenumber = UserProfile.PhoneNumber; User.username = UserProfile.UserName; User.Updateddate = DateTime.Now; _db.Entry(User).State = EntityState.Modified; _db.SaveChanges(); } return(Request.CreateResponse(HttpStatusCode.OK, "Success")); } catch (Exception E) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Failed" + E)); } }
public HttpResponseMessage AddTransaction([FromBody] M_SendInvitation SendInvitation) { try { ChitConnection _NewInvitation = new ChitConnection(); _NewInvitation.chitid = SendInvitation.ChitId; _NewInvitation.userid = SendInvitation.UserId; _NewInvitation.organiser = false; _NewInvitation.statusid = 0; _NewInvitation.createddate = DateTime.Now; _NewInvitation.updatedate = DateTime.Now; _db.ChitConnections.Add(_NewInvitation); _db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "Success")); } catch (Exception E) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Failed Transaction" + E.InnerException)); } }