Beispiel #1
0
        public string Create(aspnetuserlogins Model)
        {
            DatabaseContext db = new DatabaseContext();
            string          msg;

            try
            {
                if (ModelState.IsValid)
                {
                    Model.LoginProvider = new Random().Next(1, 1000);
                    db.aspnetuserlogins.Add(Model);
                    db.SaveChanges();
                    msg = "Saved Successfully";
                }
                else
                {
                    msg = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msg = "Error occured:" + ex.Message;
            }
            return(msg);
        }
Beispiel #2
0
        public string Delete(string Id)
        {
            DatabaseContext  db            = new DatabaseContext();
            aspnetuserlogins LoginProvider = db.aspnetuserlogins.Find(int.Parse(Id));

            db.aspnetuserlogins.Remove(LoginProvider);
            db.SaveChanges();
            return("Deleted successfully");
        }
Beispiel #3
0
        public string Edit(aspnetuserlogins Model)
        {
            DatabaseContext db = new DatabaseContext();
            string          msg;

            try
            {
                if (ModelState.IsValid)
                {
                    db.Entry(Model).State = EntityState.Modified;
                    db.SaveChanges();
                    msg = "Saved Successfully";
                }
                else
                {
                    msg = "Validation data not successfully";
                }
            }
            catch (Exception ex)
            {
                msg = "Error occured:" + ex.Message;
            }
            return(msg);
        }