Exemplo n.º 1
0
        public bool Add(Product newProduct)
        {
            bool IsAdded = false;

            try
            {
                var product = new Product();

                product.Name_prod = newProduct.Name_prod;
                product.Price     = newProduct.Price;
                product.Type_prod = newProduct.Type_prod;
                product.TimeLimit = newProduct.TimeLimit;


                db.Products.Add(product);
                var NoOfRowsAffected = db.SaveChanges();
                IsAdded = NoOfRowsAffected > 0;
            }
            catch (SqlException ex)
            {
                throw ex;
            }

            return(IsAdded);
        }
Exemplo n.º 2
0
        public bool Add(Client newClient)
        {
            bool IsAdded = false;

            try
            {
                var client = new Client();

                client.Name_cl       = newClient.Name_cl;
                client.Type_cl       = newClient.Type_cl;
                client.Status_cl     = newClient.Status_cl;
                client.Manager       = newClient.Manager;
                client.Client_status = newClient.Client_status;
                client.Manager1      = newClient.Manager1;

                db.Clients.Add(client);
                var NoOfRowsAffected = db.SaveChanges();
                IsAdded = NoOfRowsAffected > 0;
            }
            catch (SqlException ex)
            {
                throw ex;
            }

            return(IsAdded);
        }
Exemplo n.º 3
0
        public bool Add(Manager newManager)
        {
            bool IsAdded = false;

            try
            {
                var manager = new Manager();
                manager.Name_manag = newManager.Name_manag;


                db.Managers.Add(manager);
                var NoOfRowsAffected = db.SaveChanges();
                IsAdded = NoOfRowsAffected > 0;
            }
            catch (SqlException ex)
            {
                throw ex;
            }

            return(IsAdded);
        }