public IActionResult GetBoatDetailsRent(ModelRentBoat model) { if (model.RentId != null) { int myresponse = BusinessUser.StopRent(model); return(StatusCode(200, myresponse)); } string result = BusinessUser.NewRent(model); if (result == "-1") { Response.StatusCode = (int)HttpStatusCode.InternalServerError; return(Json(new { Message = "-1" })); } return(Json("ok")); }
/// <summary> /// This will allow user to rent a new boat to customer if /// -1 then db error else success /// </summary> /// <param name="modelRent"></param> /// <returns></returns> public static string NewRent(ModelRentBoat modelRent) { string result = string.Empty; int response = 0; response = registerNewUser.NewRent(modelRent); switch (response) { case -1: result = "-1"; break; default: result = "success"; break; } return(result); }
public int StopRent(ModelRentBoat rentBoat) { int result = 0; try { SqlCommand cmd = DataAccess.GetCommand(); cmd.CommandText = "Boats.BoatInfo"; cmd.Parameters.AddWithValue("@Command", "StopRent"); cmd.Parameters.AddWithValue("@Id", rentBoat.RentId); result = Convert.ToInt32(DataAccess.ExecureScaler(cmd)); } catch (Exception ex) { throw ex; } return(result); }
public int NewRent(ModelRentBoat rentBoat) { int result = 0; try { SqlCommand cmd = DataAccess.GetCommand(); cmd.CommandText = "Boats.BoatInfo"; cmd.Parameters.AddWithValue("@Command", "RentBoat"); cmd.Parameters.AddWithValue("@Id", rentBoat.Id); cmd.Parameters.AddWithValue("@HourlyRentedRate", rentBoat.HourlyRate); cmd.Parameters.AddWithValue("@Basecharges", rentBoat.BaseCharges); cmd.Parameters.AddWithValue("@CustomerName", rentBoat.CustomerName); result = Convert.ToInt32(DataAccess.ExecureScaler(cmd)); } catch (Exception ex) { throw ex; } return(result); }
/// <summary> /// This will generate final payment of Rented boat /// </summary> /// <param name="model"></param> /// <returns></returns> public static int StopRent(ModelRentBoat model) { int result = 0; return(result = registerNewUser.StopRent(model)); }