コード例 #1
0
        public apikeycontrol Update(apikeycontrol control)
        {
            var content1 = _apicontext.getAPI.Attach(control);

            content1.State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            _apicontext.SaveChanges();
            return(control);
        }
コード例 #2
0
        public apikeycontrol reset(string email)
        {
            apikeycontrol control = _apicontext.getAPI.First(a => a.ekey == email);

            control.smscounter = 0;
            _apicontext.SaveChanges();
            return(control);
        }
コード例 #3
0
        public apikeycontrol Delete(string email)
        {
            apikeycontrol control = _apicontext.getAPI.FirstOrDefault(e => e.ekey == email);

            if (control != null)
            {
                _apicontext.Remove(control);
                _apicontext.SaveChanges();
            }

            return(control);
        }
コード例 #4
0
        public ActionResult <string> addUser(string email, string pnumber, int limit)
        {
            try  {
                string apikey = apigen(email + "/" + pnumber);
                User   user   = new User {
                    emailid = email, phonenumber = pnumber, api = apikey, Limit = limit
                };
                apikeycontrol c = new apikeycontrol {
                    ekey = email, smscounter = 0
                };
                _control.Add(c);
                _iuser.Add(user);

                return("User Registration was Sucessfully Done");
            }catch (Exception e)
            {
                return("error" + e.ToString());
            }
        }
コード例 #5
0
        public ActionResult <string> update(string message, string receiver, string sender, string email)
        {
            string em    = email;
            int    g     = _iuser.Userdetails(email).Limit;
            int    limit = _control.smscount(email);

            if (g != limit)
            {
                OTPMessage otpmessage = new OTPMessage {
                    Message = message, Sender = sender, api = email, Receiver = receiver
                };
                apikeycontrol control = new apikeycontrol {
                    ekey = em, smscounter = limit + 1
                };
                // _control.Update(control);
                _message.Update(otpmessage);
                return("Message was updated Successfully");
            }
            else
            {
                return("Your limit was reached... Please renew");
            }
        }
コード例 #6
0
        public int smscount(string email)
        {
            apikeycontrol control = _apicontext.getAPI.First(e => e.ekey == email);

            return(control.smscounter);
        }
コード例 #7
0
 public apikeycontrol Add(apikeycontrol control)
 {
     _apicontext.getAPI.Add(control);
     _apicontext.SaveChanges();
     return(control);
 }