Beispiel #1
0
        public void Edit_Product(List <string> ii, string UserAdmin, string PassAdmin, int Id)
        {
            if (dbController.Checklogin_Admin(UserAdmin, PassAdmin))
            {
                using (COnnectingdB)
                {
                    var pr = COnnectingdB.product1.Where(itEm => itEm.ID == Id).FirstOrDefault();

                    pr.Name         = ii[0];
                    pr.Category     = ii[1];
                    pr.Price        = ii[2];
                    pr.Weight       = ii[3];
                    pr.Brand        = ii[4];
                    pr.Mojody_Anbar = ii[5];
                    pr.Picture      = ii[6];

                    COnnectingdB.product1.Attach(pr);
                    COnnectingdB.Entry(pr);
                    COnnectingdB.SaveChanges();
                }
            }
        }
Beispiel #2
0
        //admin edit info of himself(herself):
        public void Edit_Person_ByAdmin(List <string> qq, string Old_Username, string Old_Password)
        {
            try
            {
                if (dBController.Checklogin_Admin(Old_Username, Old_Password))
                {
                    using (ConnectingDB connecting = new ConnectingDB())
                    {
                        var ss = connecting.person1.Where(k => k.UserName == Old_Username && k.PassWord == Old_Password).FirstOrDefault();
                        ss.FirstName       = qq[0];
                        ss.LastName        = qq[1];
                        ss.Birthday_Day    = qq[2];
                        ss.Birthday_Month  = qq[3];
                        ss.Birthday_Year   = qq[4];
                        ss.E_Mail          = qq[5];
                        ss.Mobil           = qq[6];
                        ss.Telephon        = qq[7];
                        ss.Gender          = qq[9];
                        ss.Picture         = qq[12];
                        ss.UserName        = qq[10];
                        ss.PassWord        = qq[11];
                        ss.Sath_E_Dastresy = qq[8];

                        connecting.person1.Attach(ss);
                        connecting.Entry(ss);
                        connecting.SaveChanges();
                    }
                }
                else
                {
                    throw new Exception();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }