public ActionResult CreateSupplierAndBase(SupplierViewModel c)
        {
//            var v1 =TryValidateModel(c.CustomerSupplier);
//            var v2 = TryValidateModel(c.CustomerSupplierBase);

            if (ModelState.IsValid)
            {
                try
                {
                    //if code is empty then sistem has to assign one
                    if (c.CustomerSupplier.CodCustomerSupplier == null)
                    {
                        c.CustomerSupplier.CodCustomerSupplier = customerSupplierRepository.GetNewCode(c.CustomerSupplier);
                    }
                    c.CustomerSupplier.TimeStampTable = DateTime.Now;
                    customerSupplierRepository.Add(c.CustomerSupplier);

                    c.CustomerSupplierBase.TimeStampTable = DateTime.Now;
                    c.CustomerSupplierBase.CodTypeOfBase = "0001";
                    c.CustomerSupplier.CustomerSupplierBases.Add(c.CustomerSupplierBase);

                    //clisupDataRep.Edit(c);                    
                    customerSupplierRepository.Save();
                    ViewBag.Message = "Inserimento avvenuto con successo. Continuare oppure tornare alla lista";

                    return Json(new { redirectUrl = Url.Action("CreateSupplierAndBase")});
                }
                catch (Exception ex)
                {
                    ViewBag.Message = "";
                    ModelState.AddModelError(string.Empty, "Something went wrong. Message: " + ex.Message);
                }
            }
            return View(c);        

        }
 //
 // GET: /CustomerSupplier/CreateCustomer
 public ActionResult CreateSupplierAndBase()
 {
     var x = new SupplierViewModel();
     return View(x);
 }