public HttpResponseMessage PutCustomerNetBanking([FromBody] Customer customer)
        {
            try
            {
                using (BankingAppEntities db = new BankingAppEntities())
                {
                    var data = db.Customers.Find(customer.AccountNumber);

                    if (data.Otp == customer.Otp)
                    {
                        data.LoginPassword       = customer.LoginPassword;
                        data.TransactionPassword = customer.TransactionPassword;
                        db.SaveChanges();
                        return(Request.CreateResponse(HttpStatusCode.OK, "User with Account Number: " + customer.AccountNumber + " registered for Net Banking successfully!"));
                    }
                    else
                    {
                        return(Request.CreateResponse(HttpStatusCode.NotFound, "Invalid Account Number or Otp"));
                    }
                }
            }
            catch (Exception e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, e.Message));
            }
        }
 public HttpResponseMessage PutCustomerChangePassword(int CustomerId, [FromBody] Customer customer)
 {
     try
     {
         using (BankingAppEntities db = new BankingAppEntities())
         {
             var data = db.Customers.Where(s => s.CustomerId == CustomerId).FirstOrDefault();
             if (data == null)
             {
                 return(Request.CreateResponse(HttpStatusCode.NotFound, "Customer with id not found"));
             }
             else
             {
                 //data.TotalCnt = customer.TotalCnt;
                 //data.TotalCnt = data.TotalCnt + 1;
                 //if (data.TotalCnt >= 3)
                 //{
                 //    data.Status = 1;
                 //}
                 //else
                 data.TotalCnt = 0;
                 data.Status   = 0;
                 db.SaveChanges();
                 return(Request.CreateResponse(HttpStatusCode.OK, data));
             }
         }
     }
     catch (Exception e)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, e.Message));
     }
 }
 public HttpResponseMessage PutCustomer(long AccountNumber, [FromBody] Customer customer)
 {
     try
     {
         using (BankingAppEntities db = new BankingAppEntities())
         {
             var data = db.Customers.Where(c => c.AccountNumber == customer.AccountNumber).FirstOrDefault();
             if (data == null)
             {
                 return(Request.CreateResponse(HttpStatusCode.NotFound, "User with Account Number: " + AccountNumber + " not found"));
             }
             else
             {
                 data.LoginPassword       = customer.LoginPassword;
                 data.TransactionPassword = customer.TransactionPassword;
                 db.SaveChanges();
                 return(Request.CreateResponse(HttpStatusCode.OK, data));
             }
         }
     }
     catch (Exception e)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, e.Message));
     }
 }
 public HttpResponseMessage PutUserDetails(int id, [FromBody] UserDetails userdetails)
 {
     try
     {
         using (BankingAppEntities db = new BankingAppEntities())
         {
             var data = db.UserDetails.Find(id);
             if (data == null)
             {
                 return(Request.CreateResponse(HttpStatusCode.NotFound, "User with id: " + id + " not found"));
             }
             else
             {
                 data.Title                   = userdetails.Title;
                 data.FirstName               = userdetails.FirstName;
                 data.MiddleName              = userdetails.MiddleName;
                 data.LastName                = userdetails.LastName;
                 data.FatherName              = userdetails.FatherName;
                 data.MobileNumber            = userdetails.MobileNumber;
                 data.Email                   = userdetails.Email;
                 data.AadharNumber            = userdetails.AadharNumber;
                 data.DOB                     = userdetails.DOB;
                 data.ResidentialAddressLine1 = userdetails.ResidentialAddressLine1;
                 data.ResidentialAddressLine2 = userdetails.ResidentialAddressLine2;
                 data.ResidentialLandmark     = userdetails.ResidentialLandmark;
                 data.ResidentState           = userdetails.ResidentState;
                 data.ResidentialCity         = userdetails.ResidentialCity;
                 data.ResidentialPinCode      = userdetails.ResidentialPinCode;
                 data.PermanentAddressLine1   = userdetails.PermanentAddressLine1;
                 data.PermanentAddressLine2   = userdetails.PermanentAddressLine2;
                 data.PermanentLandmark       = userdetails.PermanentLandmark;
                 data.PermanentState          = userdetails.PermanentState;
                 data.PermanentCity           = userdetails.PermanentCity;
                 data.PermanentPinCode        = userdetails.PermanentPinCode;
                 data.OccupationalType        = userdetails.OccupationalType;
                 data.SourceOfIncome          = userdetails.SourceOfIncome;
                 data.GrossAnnualIncome       = userdetails.GrossAnnualIncome;
                 data.IsNetBanking            = userdetails.IsNetBanking;
                 data.DebitCard               = userdetails.DebitCard;
                 db.SaveChanges();
                 return(Request.CreateResponse(HttpStatusCode.OK, data));
             }
         }
     }
     catch (Exception e)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, e.Message));
     }
 }
 public HttpResponseMessage PostTransaction([FromBody] Transaction transaction)
 {
     try
     {
         using (BankingAppEntities db = new BankingAppEntities())
         {
             db.Transactions.Add(transaction);
             db.SaveChanges();
             return(Request.CreateResponse(HttpStatusCode.Created, transaction));
         }
     }
     catch (Exception e)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, e));
     }
 }
 public HttpResponseMessage PostUserDetails([FromBody] UserDetails userdetails)
 {
     try
     {
         using (BankingAppEntities db = new BankingAppEntities())
         {
             db.UserDetails.Add(userdetails);
             db.SaveChanges();
             return(Request.CreateResponse(HttpStatusCode.Created, userdetails));
         }
     }
     catch (Exception e)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, e));
     }
 }
 public HttpResponseMessage PostCustomer([FromBody] Customer customer)
 {
     try
     {
         using (BankingAppEntities db = new BankingAppEntities())
         {
             db.Customers.Add(customer);
             db.SaveChanges();
             return(Request.CreateResponse(HttpStatusCode.Created, customer));
         }
     }
     catch (Exception e)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, e));
     }
 }
示例#8
0
 public HttpResponseMessage PostBeneficiary([FromBody] Beneficiary beneficiary)
 {
     try
     {
         using (BankingAppEntities db = new BankingAppEntities())
         {
             db.Beneficiaries.Add(beneficiary);
             db.SaveChanges();
             return(Request.CreateResponse(HttpStatusCode.Created, beneficiary));
         }
     }
     catch (Exception e)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, e));
     }
 }
 public HttpResponseMessage DeleteUserDetails(int id)
 {
     try
     {
         using (BankingAppEntities db = new BankingAppEntities())
         {
             var data = db.UserDetails.Find(id);
             if (data == null)
             {
                 return(Request.CreateResponse(HttpStatusCode.NotFound, "User with id: " + id + " not found"));
             }
             else
             {
                 db.UserDetails.Remove(data);
                 db.SaveChanges();
                 return(Request.CreateResponse(HttpStatusCode.OK, data));
             }
         }
     }
     catch (Exception e)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, e.Message));
     }
 }
 public HttpResponseMessage DeleteCustomer(long AccountNumber)
 {
     try
     {
         using (BankingAppEntities db = new BankingAppEntities())
         {
             var data = db.Customers.Find(AccountNumber);
             if (data == null)
             {
                 return(Request.CreateResponse(HttpStatusCode.NotFound, "User with Account number: " + AccountNumber + " not found"));
             }
             else
             {
                 db.Customers.Remove(data);
                 db.SaveChanges();
                 return(Request.CreateResponse(HttpStatusCode.OK, data));
             }
         }
     }
     catch (Exception e)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, e.Message));
     }
 }
示例#11
0
 public HttpResponseMessage DeleteBeneficiary(long b_ac)
 {
     try
     {
         using (BankingAppEntities db = new BankingAppEntities())
         {
             var data = db.Beneficiaries.Find(b_ac);
             if (data == null)
             {
                 return(Request.CreateResponse(HttpStatusCode.NotFound, "Beneficiary with Account number: " + b_ac + " not found"));
             }
             else
             {
                 db.Beneficiaries.Remove(data);
                 db.SaveChanges();
                 return(Request.CreateResponse(HttpStatusCode.OK, data));
             }
         }
     }
     catch (Exception e)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, e.Message));
     }
 }