public string AddCustomer(MvCustomer customer) { string json = string.Empty; ActionProcedures.SpCustomerIns(JsonConvert.SerializeObject(customer, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }), ref json); return(json); }
public IActionResult customerUpdate([FromBody] MvCustomer customer) { try { var data = _customerService.updateCustomer(customer); return(Ok(data)); } catch (Exception ex) { throw ex; } }
public IActionResult EditCustomer([FromBody] MvCustomer customer) { try { customerService.EditCustomer(customer); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IActionResult Customer([FromBody] MvCustomer customer) { try { string json = customerService.AddCustomer(customer); return(Ok(json)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public dynamic UpdateCustomer(MvCustomer customer) { var json = JsonConvert.SerializeObject(customer); using (var sql = _dah.GetConnection()) { using (SqlCommand command = new SqlCommand("SpCustomerUpd", sql)) { command.CommandType = (System.Data.CommandType.StoredProcedure);; command.Parameters.Add(new SqlParameter("@json", json)); command.ExecuteNonQuery(); return(customer); } } }
public IActionResult AddCustomer([FromBody] MvCustomer customer) { try { var added = _customerService.AddPerson(customer); if (!added) { return(BadRequest()); } return(Ok()); } catch (Exception e) { throw e; } }
public IActionResult CustomerUpdate([FromBody] MvCustomer customer) { if (!ModelState.IsValid) { return(BadRequest()); } try { var data = _customerService.UpdateCustomer(customer); return(Ok(data)); } catch (Exception ex) { throw ex; } }
public bool AddCustomer(MvCustomer customer) { var jsonNew = JsonConvert.SerializeObject(customer); using (var conn = _dah.GetConnection()) { using (var cmd = new SqlCommand("SpCustomerInsertTsk", conn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Json", SqlDbType.NChar).Value = jsonNew; cmd.CommandTimeout = int.Parse(_commandTimeout); int rows = cmd.ExecuteNonQuery(); if (rows > 0) { return(true); } return(false); } } }
public bool AddPerson(MvCustomer customer) { using (var connection = _dah.GetConnection()) { var jsonNew = JsonConvert.SerializeObject(customer); var command = connection.CreateCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "SpCustomerInsertTsk"; command.Parameters.Add("@json", SqlDbType.NChar).Value = jsonNew; command.CommandTimeout = _comdTimeout; int rows = command.ExecuteNonQuery(); if (rows > 0) { return(true); } return(false); } }
public IActionResult AddCustomer([FromBody] MvCustomer customer) { if (!ModelState.IsValid) { return(BadRequest()); } try { var added = _customerService.AddCustomer(customer); if (!added) { return(BadRequest()); } return(Ok()); } catch (Exception) { throw; } }
public void EditCustomer(MvCustomer customer) { ActionProcedures.SpCustomerUpd(JsonConvert.SerializeObject(customer, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() })); }