Esempio n. 1
0
        public static bool UpdateCustomer(AdminRegisterationDTO data)
        {
            int tempId = Int32.Parse(data.id);

            try
            {
                UjewelriesDBContext db = new UjewelriesDBContext();
                if (data.name != null & data.name != "")
                {
                    db.Costumers.Where(a => a.id == tempId).ToList()[0].name = data.name;
                }
                if (data.password != null & data.password != "")
                {
                    db.Costumers.Where(a => a.id == tempId).ToList()[0].password = data.password;
                }
                if (data.Admin != null & data.Admin != "")
                {
                    db.Costumers.Where(a => a.id == tempId).ToList()[0].is_manager = bool.Parse(data.Admin);
                }
                db.SaveChanges();
            }
            catch
            {
                Console.WriteLine("ERROR update failed");
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
 public bool AdminRegistration(AdminRegisterationDTO data)
 {
     return(UjewelriesService.CreateCustomer(Int32.Parse(data.id),
                                             data.name, data.password,
                                             bool.Parse(data.Admin)));
 }