Beispiel #1
0
        public IActionResult CustomerAdd(Customers customer)
        {
            if (ModelState.IsValid)
            {
                var add = customerServices.CreateCustomer(customer);
                return(RedirectToAction("Index"));
            }

            return(View());
        }
Beispiel #2
0
        public ActionResult Create([Bind(Include = "CustomerId,CustomerName,Email,PhoneNumber,DateBecameCustomer")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                service.CreateCustomer(customer);
                return(RedirectToAction("Index"));
            }

            return(View(customer));
        }
Beispiel #3
0
 public async Task <IActionResult> Create(CustomerViewModel addCustomer)
 {
     if (ModelState.IsValid)
     {
         if (await _customerServices.CreateCustomer(addCustomer))
         {
             TempData["succcessMessage"] = _resourcesServices.GetLocalizedHtmlString("customer_msg_NewCustomerSuccess").ToString();
             return(RedirectToAction("Index"));
         }
     }
     ViewData["errorMessage"] = _resourcesServices.GetLocalizedHtmlString("customer_msg_NewCustomerError");
     return(View(addCustomer));
 }
 public IActionResult  CreateCustomer(CustomerVM model)
 {
     if (ModelState.IsValid)
     {
         model.Age = GetAge(model.Birthdate);
         var Result = _customerServices.CreateCustomer(model);
         if (Result.Result.Data != null)
         {
             return(Ok(Result.Result.Data));
         }
     }
     return(BadRequest("Some Proberties isinvalid.   "));
 }
 //Post API/Customer
 public int Post([FromBody] CustomerEntity customerEntity)
 {
     return(_customerServices.CreateCustomer(customerEntity));
 }
 public void CreateCustomer(String firstName, String lastName, String email, String phone, String code)
 {
     _customerServices.CreateCustomer(firstName, lastName, email, phone, code);
 }