public List <SqlParameter> SetValuesInVehicleType(VehicleTypeInfo vehicleType) { List <SqlParameter> sqlParam = new List <SqlParameter>(); if (vehicleType.VehicleTypeId != 0) { sqlParam.Add(new SqlParameter("@VehicleTypeId", vehicleType.VehicleTypeId)); } else { sqlParam.Add(new SqlParameter("@CreatedDate", vehicleType.CreatedDate)); sqlParam.Add(new SqlParameter("@CreatedBy", vehicleType.CreatedBy)); } sqlParam.Add(new SqlParameter("@VehicleTypeName", vehicleType.VehicleTypeName)); Logger.Debug("VehicleType Controller VehicleTypeName:" + vehicleType.VehicleTypeName); sqlParam.Add(new SqlParameter("@IsActive", vehicleType.IsActive)); Logger.Debug("VehicleType Controller IsActive:" + vehicleType.IsActive); sqlParam.Add(new SqlParameter("@UpdatedBy", vehicleType.UpdatedBy)); sqlParam.Add(new SqlParameter("@UpdatedDate", vehicleType.UpdatedDate)); return(sqlParam); }
public VehicleTypeInfo GetVehicleTypeIdValues(DataRow dr) { VehicleTypeInfo Val = new VehicleTypeInfo(); Val.VehicleTypeId = Convert.ToInt32(dr["VehicleTypeId"]); Val.VehicleTypeName = Convert.ToString(dr["VehicleTypeName"]); return(Val); }
public VehicleTypeViewModel() { VehicleType = new VehicleTypeInfo(); Filter = new VehicleTypeFilter(); VehicleTypes = new List <VehicleTypeInfo>(); Pager = new PaginationInfo(); FriendlyMessage = new List <FriendlyMessage>(); }
public IActionResult EditType([FromBody] VehicleTypeInfo vehicleTypeInfo) { try { Validator.validateVehicle(vehicleTypeInfo); DAVechile dATypes = new DAVechile(); return(this.OKResponse(dATypes.EditType(_context, vehicleTypeInfo, User.ToAppUser()) ? "Updated Successfully" : "Updation Failed")); } catch (DataValidationException ex) { return(this.KnowOperationError(ex.Message)); } }
public static void validateVehicle(VehicleTypeInfo vehicleTypeInfo) { if (vehicleTypeInfo.Id == 0) { throw new DataValidationException($"Id does not exists"); } if (string.IsNullOrEmpty(vehicleTypeInfo.Name)) { throw new DataValidationException($"Name does not exists"); } if (string.IsNullOrEmpty(vehicleTypeInfo.Image)) { throw new DataValidationException($"Image does not exists"); } }
public void Update(VehicleTypeInfo vehicleType) { _sqlHelper.ExecuteNonQuery(SetValuesInVehicleType(vehicleType), Storeprocedures.spUpdateVehicleType.ToString(), CommandType.StoredProcedure); }
public int Insert(VehicleTypeInfo vehicleType) { return(Convert.ToInt32(_sqlHelper.ExecuteScalerObj(SetValuesInVehicleType(vehicleType), Storeprocedures.spInsertVehicleType.ToString(), CommandType.StoredProcedure))); }