Exemple #1
0
        public Form1()
        {
            InitializeComponent();
            BuyerRepository buyer = new BuyerRepository(Global.ConnectionStringSql, Global.ProviderName);

            buyer.Add(new Buyer());
        }
        public ActionResult Index(Buyer b)
        {
            if (ModelState.IsValid)
            {
                b.Valid = 1;
                buyerRepository.Add(b);

                /************** Saving log ***************/

                log.DoAll("Buyer: " + b.ID + ", " + b.Name + ", " + b.Pass
                          + ", " + b.ComName + ", " + b.Email + ", " + b.Country
                          + ", " + b.Valid + ".");

                /*****************************************/

                buyerRepository.Save();

                Session["buyerID"] = b.ID;
                return(View("Confermation"));
            }
            return(View("~/Views/Home/Error.aspx"));
        }
Exemple #3
0
 public bool Add(Person person)
 {
     try
     {
         Buyer buyer = new Buyer()
         {
             FirstName = person.FirstName,
             LastName  = person.LastName,
             Email     = person.Email,
             Password  = person.Password,
             Address   = new Address()
             {
                 CityId = person.CityId
             }
         };
         _buyerRepository.Add(buyer);
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
 public Response Add([FromBody] Buyer value)
 {
     return(repo.Add(value));
 }