public override APIResponse Insert(ICategory CategoryObj)
 {
     try
     {
         bool Response = new Security(UserProfileObj).AuthenticateAdmin();
         if (Response == true)
         {
             if (0 == CategoryTemplateObj.Insert(CategoryObj))
             {
                 return(APIResponse.NOT_OK);
             }
             else
             {
                 return(APIResponse.OK);
             }
         }
         else
         {
             return(APIResponse.NOT_AUTHENTICATED);
         }
     }
     catch (NullReferenceException nex)
     {
         Logger.Instance().Log(Warn.Instance(), new LogInfo("Received null reference while adding category (Routine : AuthenticateAdmin), might be token manipulation. Check token : " + UserProfileObj.GetToken()));
         throw nex;
     }
     catch (Exception ex)
     {
         Logger.Instance().Log(Fatal.Instance(), ex);
         throw ex;
     }
 }
Ejemplo n.º 2
0
 public override APIResponse Insert(ICardDetails CardDetailsObj)
 {
     try
     {
         AESObj.GenerateKey();
         CardDetailsObj.SetIV(AESObj.GetIV());
         CardDetailsObj.SetDecryptionKey(AESObj.GetKey());
         CardDetailsObj.SetName(AESObj.Encrypt(CardDetailsObj.GetName()));
         CardDetailsObj.SetCardNumber(AESObj.Encrypt(CardDetailsObj.GetCardNumber()));
         CardDetailsObj.SetExpiryMonth(AESObj.Encrypt(CardDetailsObj.GetExpiryMonth()));
         CardDetailsObj.SetExpiryYear(AESObj.Encrypt(CardDetailsObj.GetExpiryYear()));
         CardDetailsObj.SetCvv(AESObj.Encrypt(CardDetailsObj.GetCvv()));
         bool Response = new Security(UserProfileObj).AuthenticateUser();
         if (Response == true)
         {
             if (0 == CardDetailsDataLayerObj.Insert(CardDetailsObj))
             {
                 return(APIResponse.NOT_OK);
             }
             else
             {
                 return(APIResponse.OK);
             }
         }
         else
         {
             return(APIResponse.NOT_AUTHENTICATED);
         }
     }
     catch (NullReferenceException nex)
     {
         Logger.Instance().Log(Warn.Instance(), new LogInfo("Received null reference while adding card (Routine : AuthenticateUser), might be token manipulation. Check token : " + UserProfileObj.GetToken()));
         throw nex;
     }
     catch (Exception ex)
     {
         Logger.Instance().Log(Fatal.Instance(), ex);
         throw ex;
     }
 }