예제 #1
0
 public void AddCustomer(Customer dataModel)
 {
     if (customerValidation.ValidateCustomer(dataModel))
     {
         customerDAL.Add(dataModel);
     }
 }
예제 #2
0
 public void AddCustomer(Customer customer)
 {
     if (_realPersonCheck.CheckIfRealPerson(customer))
     {
         _customerDAL.Add(customer);
     }
     else
     {
         throw new Exception("Not a real person!");
     }
 }
 public IActionResult Create([Bind("Id,Name,Email,Username,Pwd,LastName")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _context.Add(customer);
         }
         catch (Exception)
         {
             ModelState.AddModelError("CustAddError", "Creating the customer failed change username/email.");
             return(View(customer));
         }
         logger.LogInformation($"Successfully created customer");
         return(RedirectToAction(nameof(Index)));
     }
     return(RedirectToAction("Create", customer));
 }
예제 #4
0
        public IResult Insert(Customer customer)
        {
            //if (customer.UserId > 0)
            //{
            //    _customerDAL.Add(customer);
            //    return new SuccessResult(Messages.CustomerAdded);
            //}
            //return new ErrorResult(Messages.CustomerNotAddedUserId);

            //if (customer.UserId > 0)
            //{
            //    _customerDAL.Add(customer);
            //    return new SuccessResult(Messages.CustomerAdded);
            //}
            //return new ErrorResult(Messages.CustomerNotAddedUserId);

            //ValidationTool.Validate(new CustomerValidator(), customer);

            _customerDAL.Add(customer);
            return(new SuccessResult(Messages.CustomerAdded));
        }
예제 #5
0
 public Customers Add(Customers entity)
 {
     try
     {
         var customer = _CustomerDAL.GetAll();
         var IsThere  = (from c in customer where c.Email == entity.Email && c.FirstName == entity.FirstName && c.LastName == entity.LastName select c.ID).FirstOrDefault();
         if (IsThere == 0)
         {
             _CustomerDAL.Add(entity);
             return(entity);
         }
         else
         {
             return(Get(IsThere));
         }
     }
     catch (Exception)
     {
         return(entity);
     }
 }
예제 #6
0
 {                                             // Metot parametresi eklemekten ileri seviye olan constructor'a eklemekte bulur.
     // Henüz öğrenilmedi.
     public void Add(ICustomerDAL customerDAL) // ICustomerDAL veri tipi ile onu kullanan her tipin kullanılması sağlanır.
     {
         customerDAL.Add();                    // Seçilen, gönderilen tipin Add()'i çalışır.
     }
예제 #7
0
 public IResult Add(NCustomer customer)
 {
     _iCustomerDal.Add(customer);
     return(new SuccessResult(Messages.CustomerAdded));
 }
예제 #8
0
 public static int AddCustomer(Customer data)
 {
     return CustomerDB.Add(data);
 }
예제 #9
0
 public IResult Add(Customer customer)
 {
     _customerDAL.Add(customer);
     return(new SuccessResult());
 }
예제 #10
0
 public IResult Add(Customer customer)
 {
     _customerDAL.Add(customer);
     return(new SuccessResult(Messages.CustomerAdded));
 }
예제 #11
0
 public IResult Add(Customer customer)
 {
     customer.FindexScore = _random.Next(0, 1900);
     _customerDAL.Add(customer);
     return(new SuccessResult());
 }