Exemple #1
0
        public HttpResponseMessage PutNewPassword(int id, [FromBody] UsersAccount setpassword)
        {
            try
            {
                using (BankingDbEntities db = new BankingDbEntities())
                {
                    var data = db.UsersAccounts.Find(id);

                    if (data == null)
                    {
                        return(Request.CreateResponse(HttpStatusCode.NotFound, "Account number" + id + " not found"));
                    }
                    else
                    {
                        data.Login_Password = setpassword.Login_Password;
                        db.SaveChanges();
                        return(Request.CreateResponse(HttpStatusCode.OK, data));
                    }
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }
 public HttpResponseMessage PostTransaction(int id, [FromBody] Transaction d)
 {
     try
     {
         using (BankingDbEntities db = new BankingDbEntities())
         {
             d.From_Account_Number = id;
             d.Transaction_Date    = DateTime.Now;
             var data = db.UsersAccounts.Find(id);
             if (d.Amount > data.Balance)
             {
                 return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Insufficient fund"));
             }
             else
             {
                 db.Transactions.Add(d);
                 db.SaveChanges();
                 return(Request.CreateResponse(HttpStatusCode.Created, d));
             }
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
        public HttpResponseMessage PostAdLogin([FromBody] Admin1 ad)
        {
            try
            {
                using (BankingDbEntities db = new BankingDbEntities())
                {
                    //var Obj = db.Admins.Find(ad.Admin_Id);
                    var Obj  = db.Admins.Where(a => a.Admin_Id == ad.Admin_Id).First();
                    var obj2 = Obj.Password;
                    if (obj2 != ad.Password)
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Admin invalid"));
                    }

                    else
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, "Successful Login."));
                    }
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }
 public HttpResponseMessage GetBenificiary(int id)
 {
     using (BankingDbEntities db = new BankingDbEntities())
     {
         var data = db.Beneficiaries.Where(a => a.User_Account == id).ToList();
         return(Request.CreateResponse(HttpStatusCode.OK, data));
     }
 }
 public HttpResponseMessage GetTransaction(int id)
 {
     using (BankingDbEntities db = new BankingDbEntities())
     {
         var data = db.Transactions.Where(a => a.From_Account_Number == id).ToList();
         return(Request.CreateResponse(HttpStatusCode.OK, data));
     }
 }
 public HttpResponseMessage GetUser(int id)
 {
     using (BankingDbEntities db = new BankingDbEntities())
     {
         var data = db.UsersAccounts.Where(a => a.Customer_Id == id).First();
         return(Request.CreateResponse(HttpStatusCode.OK, data));
     }
 }
Exemple #7
0
 public HttpResponseMessage GetDetails()
 {
     using (BankingDbEntities db = new BankingDbEntities())
     {
         var data = db.UserDetails.Where(user => user.Approval_Status == "no").ToList();
         return(Request.CreateResponse(HttpStatusCode.OK, data));
     }
 }
Exemple #8
0
        public HttpResponseMessage PutDetails(int id, [FromBody] UserDetail details)
        {
            try
            {
                using (BankingDbEntities db = new BankingDbEntities())
                {
                    var data = db.UserDetails.Find(id);

                    if (data == null)
                    {
                        return(Request.CreateResponse(HttpStatusCode.NotFound, "Dept with id= " + id + " not found"));
                    }
                    else
                    {
                        data.Mobile_Number          = details.Mobile_Number;
                        data.Email_Id               = details.Email_Id;
                        data.Occupation_type        = details.Occupation_type;
                        data.Source_of_Income       = details.Source_of_Income;
                        data.PermanentAddress_Line1 = details.PermanentAddress_Line1;
                        data.PermanentAddress_Line2 = details.PermanentAddress_Line2;
                        data.PermanentCity          = details.PermanentCity;
                        data.PermanentLankmark      = details.PermanentLankmark;
                        data.PermanentState         = details.PermanentState;
                        data.PermanentPincode       = details.PermanentPincode;
                        data.Address_Line1          = details.Address_Line1;
                        data.Address_Line2          = details.Address_Line2;
                        data.City     = details.City;
                        data.Lankmark = details.Lankmark;
                        data.State    = details.State;
                        data.Pincode  = details.Pincode;

                        data.Gross_Annual_Income = details.Gross_Annual_Income;
                        if (data.Approval_Status == "no")
                        {
                            if (details.Approval_Status == "yes")
                            {
                                data.Approval_Status = details.Approval_Status;
                            }
                        }
                        db.SaveChanges();
                        return(Request.CreateResponse(HttpStatusCode.OK, data));
                    }
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }
Exemple #9
0
 public HttpResponseMessage GetDetails(int id)
 {
     using (BankingDbEntities db = new BankingDbEntities())
     {
         var data = db.UserDetails.Find(id);
         if (data != null)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, data));
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Userdetail with refid= " + id + " not found"));
         }
     }
 }
Exemple #10
0
 public HttpResponseMessage GetSetnewPassword(int id)
 {
     using (BankingDbEntities db = new BankingDbEntities())
     {
         var data = db.UsersAccounts.Where(e => e.Customer_Id == id).FirstOrDefault();
         if (data != null)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, data));
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "User with Accountnumber= " + id + " not found"));
         }
     }
 }
Exemple #11
0
 public HttpResponseMessage GetCustId(int id)
 {
     using (BankingDbEntities db = new BankingDbEntities())
     {
         var data = db.UsersAccounts.Find(id);
         if (data != null)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, data));
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "User with Accountnumber= " + id + " not found"));
         }
     }
 }
Exemple #12
0
        public HttpResponseMessage GetRefernceid(int id)
        {
            using (BankingDbEntities db = new BankingDbEntities())
            {
                var data = db.UserDetails.Where(user => user.Aadhar_Number == id).FirstOrDefault();

                if (data != null)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, data));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Userdetail with Aadharnumber= " + id + " not found"));
                }
            }
        }
Exemple #13
0
        public HttpResponseMessage PostDetails([FromBody] UserDetail detail)
        {
            try
            {
                using (BankingDbEntities db = new BankingDbEntities())
                {
                    detail.Approval_Status = "no";
                    db.UserDetails.Add(detail);
                    db.SaveChanges();

                    return(Request.CreateResponse(HttpStatusCode.Created, detail));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }
 public HttpResponseMessage GetTransaction(int id, int tr)
 {
     using (BankingDbEntities db = new BankingDbEntities())
     {
         var         data = db.Transactions.Where(a => a.From_Account_Number == id).ToList();
         Transaction t    = new Transaction();
         foreach (var i in data)
         {
             if (i.Transaction_Id == tr)
             {
                 t = i;
                 break;
             }
         }
         if (t != null)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, t));
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Transaction with transactoin id= " + id + " not found"));
         }
     }
 }